'Main Menu', ) ); //////////////////////////////////////////////////////////////////// // Register the Sidebar(s) //////////////////////////////////////////////////////////////////// add_action( 'widgets_init', 'blogmaster_widgets_init' ); function blogmaster_widgets_init() { register_sidebar( array( 'name' => __('Right Sidebar', 'blogmaster'), 'id' => 'right-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __('Left Sidebar', 'blogmaster'), 'id' => 'left-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Front Page: Content Top Section', 'blogmaster' ), 'id' => 'front_page_content_top_section', 'description' => __( 'Content Top Section', 'blogmaster' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } //////////////////////////////////////////////////////////////////// // Register hook and action to set Main content area col-md- width based on sidebar declarations //////////////////////////////////////////////////////////////////// add_action( 'blogmaster_main_content_width_hook', 'blogmaster_main_content_width_columns'); function blogmaster_main_content_width_columns () { $columns = '12'; if (get_theme_mod( 'rigth-sidebar-check', 1 ) != 0 ) { $columns = $columns - get_theme_mod( 'right-sidebar-size', 3 ); } if (get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - get_theme_mod( 'left-sidebar-size', 3 ); } echo $columns; } function blogmaster_main_content_width() { do_action('blogmaster_main_content_width_hook'); } //////////////////////////////////////////////////////////////////// // Add support for a featured image and the size //////////////////////////////////////////////////////////////////// add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(300,300, true); add_image_size( 'twp-home', 731, 441, true ); add_image_size( 'twp-single', 1170, 450, true ); add_image_size( 'twp-slider-nav', 234, 131, true ); //////////////////////////////////////////////////////////////////// // Adds RSS feed links to for posts and comments. //////////////////////////////////////////////////////////////////// add_theme_support( 'automatic-feed-links' ); //////////////////////////////////////////////////////////////////// // Set Content Width //////////////////////////////////////////////////////////////////// if ( ! isset( $content_width ) ) $content_width = 800; //////////////////////////////////////////////////////////////////// // Schema.org microdata //////////////////////////////////////////////////////////////////// function blogmaster_tag_schema() { $schema = 'http://schema.org/'; // Is single post if(is_single()) { $type = "Article"; } // Is author page elseif( is_author() ) { $type = 'ProfilePage'; } // Is search results page elseif( is_search() ) { $type = 'SearchResultsPage'; } else { $type = 'WebPage'; } echo 'itemscope itemtype="' . $schema . $type . '"'; } //////////////////////////////////////////////////////////////////// // Breadcrumbs //////////////////////////////////////////////////////////////////// function blogmaster_breadcrumb () { global $post,$wp_query; //schema link $schema_link = 'http://data-vocabulary.org/Breadcrumb'; $home = __('Home', 'blogmaster'); $delimiter = ' » '; $homeLink = home_url(); if (is_home() || is_front_page()) { // no need for breadcrumbs in homepage } else { echo ''; } } if ( ! function_exists( 'blogmaster_content_nav' ) ) : //////////////////////////////////////////////////////////////////// // Display navigation to next/previous pages when applicable //////////////////////////////////////////////////////////////////// function blogmaster_content_nav( $nav_id ) { global $wp_query, $post; // Don't print empty markup on single pages if there's nowhere to navigate. if ( is_single() ) { $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) return; $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; ?> str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?page=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => __('← Previous', 'blogmaster' ), 'next_text' => __('Next →', 'blogmaster' ), )); if (is_array($pages)) { $current_page = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo ''; } } //////////////////////////////////////////////////////////////////// // Site Favicon //////////////////////////////////////////////////////////////////// function blogmaster_favicon() { if ( get_theme_mod( 'site_favicon_upload', '' ) != '' ) { $site_favicon = get_theme_mod( 'site_favicon_upload', '' ); $site_favicon_output = ''; if ( !empty( $site_favicon ) ) { $site_favicon_output .= ''; } echo $site_favicon_output; } } add_action( 'admin_head', 'blogmaster_favicon' ); add_action( 'wp_head', 'blogmaster_favicon' ); //////////////////////////////////////////////////////////////////// // Meta functions //////////////////////////////////////////////////////////////////// function blogmaster_comments() { global $post; $args = array( 'number' => '1', 'post_id' => $post->ID, ); $comments = get_comments($args); $commentslink = get_comments_link( $post->ID ); if (!empty($comments)) { foreach($comments as $comment) : $length = 80; // adjust to needed length $thiscomment = $comment->comment_content; if ( strlen($thiscomment) > $length ) { $thiscomment = substr($thiscomment,0,$length); $thiscomment = $thiscomment .' ...'; } echo ''. __( 'By: ', 'blogmaster') .'',($comment->comment_author . '

' . $thiscomment . '

'); endforeach; } else { echo '

'. __( 'No comments', 'blogmaster') .'

'; } echo '

'. __( 'Add your comment', 'blogmaster') .'

'; } function blogmaster_comments_count() { global $post; $args = array( 'post_id' => $post->ID, 'count' => true ); $comments = get_comments($args); echo $comments; } function blogmaster_cat_list() { global $post; $categories = get_the_category(); $separator = ', '; if($categories){ foreach($categories as $category) { echo '' . $category->cat_name . ''.$separator; } } } ?>