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

', 'after_title' => '

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

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Front Page: Content Top Section', 'blogmaster' ), 'id' => 'blogmaster-front-page-content-section', 'description' => __( 'Content Top Section', 'blogmaster' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __('Area After First Post', 'blogmaster'), 'id' => 'blogmaster-post-area', 'description' => __( 'Suitable for text widget.', 'blogmaster' ), 'before_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 - esc_attr(get_theme_mod( 'right-sidebar-size', 3 )); } if (get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - esc_attr(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( 'blogmaster-home', 731, 441, true ); add_image_size( 'blogmaster-single', 1170, 450, true ); add_image_size( 'blogmaster-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; //////////////////////////////////////////////////////////////////// // 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 ''; } } //////////////////////////////////////////////////////////////////// // Display navigation to next/previous pages when applicable //////////////////////////////////////////////////////////////////// if ( ! function_exists( 'blogmaster_content_nav' ) ) : 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 ''; } } //////////////////////////////////////////////////////////////////// // 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') .'',(esc_attr($comment->comment_author) . '

' . esc_attr($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 '' . esc_attr($category->cat_name) . ''.$separator; } } } ?>