__( "Post Default", TCB_TEXT_DOMAIN ), "desc" => __( "Display either the full post content or the excerpt content on the front page.", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_post_default", "value" => "radio", "options" => array("content" => "post_content()", "excerpt" => "post_excerpt()"), "std" => "excerpt" ), array ( "name" => __( "Post Meta", TCB_TEXT_DOMAIN ), "desc" => __( "Displays the post meta data. Name, Date and Post Count.", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_post_meta", "value" => "radio", "options" => array("yes" => "Yes", "no" => "No"), "std" => "no" ), array ( "name" => __( "Post Meta Image", TCB_TEXT_DOMAIN ), "desc" => __( 'Displays a post meta image. (to add the image use the "Set featured image" on the post.', TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_post_meta_image", "value" => "radio", "options" => array("yes" => "Yes", "no" => "No"), "std" => "no" ), array ( "name" => __( "Header Image Height (pixels)", TCB_TEXT_DOMAIN ), "desc" => __( "Change the default hight for the header image

*NOTE - If the value is changed after the image is set the image will be resized and NOT Cropped. ", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_header_image_height", "value" => "text", "std" => TCB_CUSTOM_HEADER_DEFAULT_HEIGHT , "sanitize_type" => "int" ), array ( "name" => __( "Turn on font Options", TCB_TEXT_DOMAIN ), "desc" => __( "ONLY Turns the font options BELOW on or off", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_turn_on_off", "value" => "radio", "options" => array("on" => "On", "off" => "Off"), "std" => "off" ), array ( "name" => __( "Header Text Alignment", TCB_TEXT_DOMAIN ), "desc" => __( "Align the title and Tag line left or right (it is recomended that if you use the custom header function to turn of the text under that option due to formating restrictions, unless you fix that through the css.)", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_alt_title_align", "selector" => array("#header .heading", "#header .heading"), "property" => array("float", "text-align"), "value" => "radio", "options" => array ( "left" => "Align Left", "right" => "Align Right"), "std" => "right" ), array ( "name" => __( "Body Text Size", TCB_TEXT_DOMAIN ), "desc" => __( 'Set the font size for the body text (Default = 16px. THIS VALUE WILL AFFECT ALL FONT SIZES.)', TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_alt_body_text_size", "selector" => "p", "property" => "font-size", "value" => "text", "std" => "16px" , "sanitize_type" => "fontsize" ), array ( "name" => __( "Text Color (hex value)", TCB_TEXT_DOMAIN ), "desc" => __( "Select a colour for p, span, div.", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_alt_text_colour", "selector" => "p", "property" => "color", "value" => "text", "std" => "#525244" , "sanitize_type" => "hexcolor"), array ( "name" => __( "Heading Color (hex value)", TCB_TEXT_DOMAIN ), "desc" => __( "Select colour for all H tags.", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_alt_header_colour", "selector" => array ( "h1", "h2", "h3", "h4", "h5", "h6" ), "property" => array ( "color", "color", "color", "color", "color", "color" ), "value" => "text", "std" => "#cccc9c" , "sanitize_type" => "hexcolor" ), array ( "name" => __( "Link Color (hex value)", TCB_TEXT_DOMAIN ), "desc" => __( "Select colour for link text.", TCB_TEXT_DOMAIN ), "id" => TCB_SHORT_NAME."_alt_link_colour", "selector" => array ( "a", ".tagcloud a", "#wp-calendar tr td a:hover" ), "property" => array ( "color", "color", "background-color" ), "value" => "text", "std" => "#86865f" , "sanitize_type" => "hexcolor" ), ); // Get theme options from db global $theme_options_db; $theme_options_db = get_theme_mod( TCB_SHORT_NAME, false ); // Found nothing in database, set defaults if ($theme_options_db == false) { foreach ($theme_options AS $value) { if (array_key_exists("id", $value)) { $theme_options_db[ $value['id'] ] = $value['std']; } } } // Set wp_nav_menu register_nav_menus( array( 'primary' => __( 'Primary Navigation', TCB_TEXT_DOMAIN ), ) ); // Set the default content width (.content_area) if one is not set. if ( ! isset( $content_width ) ) $content_width = 660; // This feature enables post and comment RSS feed links to head add_theme_support('automatic-feed-links'); // Add Post Format Support add_theme_support( 'post-formats', array( 'aside', 'status' ) ); // Add custom background support add_custom_background(); // Add editor style support add_editor_style(); // Set post thumbnail add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( TCB_POST_THUMBNAIL_HEIGHT, TCB_POST_THUMBNAIL_WIDTH, true ); // Add Custom Header Support if ( ! defined( 'HEADER_TEXTCOLOR' ) ) define( 'HEADER_TEXTCOLOR', '' ); $custom_header_image_height = commonblog_get_option(TCB_SHORT_NAME . "_header_image_height", TCB_CUSTOM_HEADER_DEFAULT_HEIGHT); define( 'HEADER_IMAGE_WIDTH', apply_filters( 'commonblog_header_image_width', TCB_CUSTOM_HEADER_DEFAULT_WIDTH ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'commonblog_header_image_height', $custom_header_image_height ) ); if ( ! defined( 'NO_HEADER_TEXT' ) ) define( 'NO_HEADER_TEXT', true ); add_custom_image_header( '', 'commonblog_admin_header_callback' ); } add_action("after_setup_theme", "common_blog_after_setup_theme"); /** * Theme init */ function common_blog_init() { // Set up Widget Area's // Beside Menu register_sidebar( array( 'name' => __( 'Beside Menu', TCB_TEXT_DOMAIN ), 'id' => 'beside-menu', 'description' => __( 'Widget area, right of the menu.', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Global Sidebar register_sidebar( array( 'name' => __( 'Default Sidebar', TCB_TEXT_DOMAIN ), 'id' => 'defualt-sidebar', 'description' => __( 'Global Widget Area. Any widgets placed here will be on every page.', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' ) ); // Author widget area register_sidebar( array( 'name' => __( 'Author Sidebar', TCB_TEXT_DOMAIN ), 'id' => 'author-sidebar', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' ) ); // Footer widget area 1 - Empty by default. register_sidebar( array( 'name' => __( 'First Footer Widget Area', TCB_TEXT_DOMAIN ), 'id' => 'footer-column-1', 'description' => __( 'The first footer widget area', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Footer widget area 2 - Empty by default. register_sidebar( array( 'name' => __( 'Second Footer Widget Area', TCB_TEXT_DOMAIN ), 'id' => 'footer-column-2', 'description' => __( 'The second footer widget area', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Footer widget area 3 - Empty by default. register_sidebar( array( 'name' => __( 'Third Footer Widget Area', TCB_TEXT_DOMAIN ), 'id' => 'footer-column-3', 'description' => __( 'The third footer widget area', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Footer widget area 4 - Empty by default. register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', TCB_TEXT_DOMAIN ), 'id' => 'footer-column-4', 'description' => __( 'The fourth footer widget area', TCB_TEXT_DOMAIN ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } add_action('init', 'common_blog_init'); /** * Admin page theme init */ function commonblog_admin_init() { // Enque admin css $file_dir = get_template_directory_uri(); wp_enqueue_style("CommonBlogCss", $file_dir."/admin-style.css", false, "1.0", "all"); } add_action('admin_init', 'commonblog_admin_init'); /** * Admin header callback for custom image header */ function commonblog_admin_header_callback() { // Does nothing at the time. } /** * This theme will revert to wp_page_menu if wp_nav_menu is not used. * @param array $args * @return array */ function commonblog_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'commonblog_page_menu_args' ); /** * Removes [...] from the excerpt * @param string $more * @return string */ function commonblog_excerpt_more($more) { return ''; }; add_filter('excerpt_more', 'commonblog_excerpt_more'); /** * Comment layout ("Borrowed" from TwentyTen) ;) */ function commonblog_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    %s says:'), get_comment_author_link()) ?>
    comment_approved == '0') : ?>
  • max_num_pages; if ( !$pages ) { $pages = 1; } } if ( 1 != $pages ) { echo "\n"; } } /** * Common Blog admin options page */ function commonblog_admin() { //must check that the user has the required capability if ( !current_user_can( 'edit_theme_options' ) ) { wp_die( __('You do not have sufficient permissions to access this page.') ); } global $theme_options; $i=0; if ( isset ($_REQUEST['saved']) && ($_REQUEST['saved'] ) )echo '

    '.TCB_THEME_NAME.' settings saved.

    '; if ( isset ($_REQUEST['reset']) && ($_REQUEST['reset'] ) ) echo '

    '.TCB_THEME_NAME.' settings reset.

    '; ?>

    Settings

    " />
    $option) { ?> />
    />
    $row) { if ($id == $row['id']) { $current_theme_option = $row; break; } } if ($current_theme_option) { // Theme option: Radio / Select if ($current_theme_option['value'] == "radio" || $current_theme_option['value'] == "select") { if (array_key_exists($value, $current_theme_option['options'])) { return $value; } else { return $current_theme_option['std']; } } // Theme option: Checkbox elseIf ($current_theme_option['value'] == "checkbox") { if ($value == "on" || $value == "off") { return $value; } else { return $current_theme_option['std']; } } // Theme option: Text elseIf ($current_theme_option['value'] == "text") { // Sanitize type: integer if ($current_theme_option['sanitize_type'] == "int") { $value = (int)$value; if ($value) { return $value; } else { return $current_theme_option['std']; } } // Sanitize type: Font size elseIf ($current_theme_option['sanitize_type'] == "fontsize") { // Remove any white space characters (to help the user) $value = preg_replace("/\s/", "", $value); // Change "," to "." (to help the user) $value = str_replace(",", ".", $value); // Match it if ( preg_match("/^([0-9\.]{1,7})(px|em|pt)$/i", $value) ) { return $value; } // No match, return default else { return $current_theme_option['std']; } } // Sanitize type: Hex color elseIf ($current_theme_option['sanitize_type'] == "hexcolor") { // Remove any white space characters (to help the user) $value = preg_replace("/\s/", "", $value); // Match it if ( preg_match("/^(#)([0-9a-f]{3,6})$/i", $value) ) { return $value; } // No match, return default else { return $current_theme_option['std']; } } } } } ?>