for posts and comments. */ add_theme_support( 'automatic-feed-links' ); /* Switches default core markup for search form, comment form, and comments to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list' ) ); /* This theme supports all available post formats by default. See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); add_theme_support( "custom-header", array( 'default-image' => '', 'width' => 1920, 'height' => 245, 'flex-width' => false, 'flex-height' => false, 'random-default' => false, 'header-text' => true, 'default-text-color' => '#444', 'uploads' => true, 'wp-head-callback' => 'best_header_style', 'admin-head-callback' => '', 'admin-preview-callback' => '', ) ); /* This theme supports custom background color and image, and here we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'fff', ) ); /* This theme uses a custom image size for featured images, displayed on "standard" posts. */ add_theme_support( 'post-thumbnails' ); add_image_size( 'best_image_content_size', 656, 9999 ); /* Unlimited height, soft crop */ } /* Function add menu pages */ function best_admin_menu() { global $bws_theme_info; if ( empty( $bws_theme_info ) ) { if ( ( function_exists( 'wp_get_theme' ) ) ) { $current_theme = wp_get_theme(); $current_theme_ver = $current_theme->get( 'Version' ); } else $current_theme_ver = ''; $bws_theme_info = array( 'id' => '149', 'version' => $current_theme_ver ); } require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' ); add_theme_page( 'BWS Themes', 'BWS Themes', 'edit_theme_options', 'bws_themes', 'bws_add_themes_menu_render' ); } /* register navigation menu */ function best_register_nav_menu() { register_nav_menu( 'header-menu', __( 'Header Menu', 'best' ) ); } /* Сonclusion sidebar */ function best_register_sidebar() { /* Right sidebar */ register_sidebar( array( 'name' => __( 'Home Right Sidebar', 'best' ), 'id' => 'best_right_sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); /* Footer sidebar */ register_sidebar( array( 'name' => __( 'Footer Sidebar', 'best' ), 'id' => 'best_footer_sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } /* Proper way to enqueue scripts and styles */ function best_style_scripts() { /* Adds JavaScript to pages with the comment form to support sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); wp_enqueue_style( 'best_styles', get_stylesheet_uri() ); wp_enqueue_script( 'best_scripts', get_template_directory_uri() . '/js/scripts.js', array( "jquery" ) ); wp_enqueue_script( 'best_html5', get_template_directory_uri() . '/js/html5.js' );/* including scripts for compatibility html5 with IE */ $script_localization = array( /* array with elements to localize in scripts */ 'choose_file' => __( 'Choose file', 'best' ), 'file_is_not_selected' => __( 'File is not selected', 'best' ), 'best_home_url' => esc_url( home_url() ), ); wp_localize_script( 'best_scripts', 'script_loc', $script_localization );/* localization in scripts */ } /* Set up post entry meta. Prints HTML with meta information for current post: categories, tags, permalink, author, and date. */ function best_entry_meta() { /* Translators: used between list items, there is a space after the comma. */ $categories_list = get_the_category_list( ', ' ); /* Translators: used between list items, there is a space after the comma. */ $tag_list = get_the_tag_list( '', ', ' ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by', 'best' ) . ' %s', get_the_author() ) ), get_the_author() ); /* Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. */ if ( $tag_list ) { $utility_text = _n( __( 'This entry was posted in', 'best' ) . ' %1$s ' . __( 'and tagged', 'best' ) . ' %2$s ' . __( 'on', 'best' ) . ' %3$s ' . __( 'by', 'best' ) . ' %4$s.' ); } elseif ( $categories_list ) { $utility_text = _n( __( 'This entry was posted in', 'best' ) . ' %1$s ' . ' %3$s ' . __( 'by', 'best' ) . ' %4$s.' ); } else { $utility_text = _n( __( 'This entry was posted in', 'best' ) . ' %3$s ' . __( 'by', 'best' ) . ' %4$s.' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } /* Includes support Breadcrumbs */ function best_breadcrumbs() { ?>

' . __( 'Home', 'best' ) . ""; /* link to Front Page */ } /*endif is_front_page() */ if ( is_single() ) { /* show title differently depending on whether list of categories is displayed */ if ( has_category() ) { /* check if the post belongs to any categories */ echo ' / ' . get_the_title(); } else { echo ' / ' . get_the_title(); } if ( isset( $_GET[ 'page' ] ) && ! empty( $_GET[ 'page' ] ) ) { /* if it is a page of a paginated post */ if ( ! is_front_page() ) { /* if it is not home page add hyphen before 'page' */ $symbol_before_page = ' / '; } else { $symbol_before_page = ''; } echo $symbol_before_page; _e( 'Page ','best' ); echo $_GET[ 'page' ]; } } elseif ( is_category() ) { $category = get_queried_object(); $this_cat = $category->name; $cat_bread = array(); if ( $category->parent ) { while ( $category->parent ) { $category = get_category( $category->parent ); array_push( $cat_bread, ' / ' . $category->name . '' ); } for ( $i = count( $cat_bread ) - 1; $i >= 0; $i-- ) { echo $cat_bread[$i]; } } echo ' / ' . $this_cat; } elseif ( is_attachment() ) { echo ' / ' . get_the_title(); } elseif ( is_page() ) { global $post; if( $post->ancestors ) { /* reverse order of a parent pages array for the current page */ $ancestors = array_reverse( $post->ancestors ); /* display links to parent pages of the current page */ for( $i = 0; $i < count( $ancestors); $i++ ) { if ( 0 == $i ) { echo ' / ' . get_the_title( $ancestors[ $i ] ) . ''; } else { echo ' / ' . get_the_title( $ancestors[ $i ] ) . ''; } } echo ' / ' . get_the_title(); } else { echo ' / ' . get_the_title(); } } elseif ( is_tag() ) { /* if it is a tags archive page */ printf( ' / %s', single_tag_title( '', false ) ); } elseif ( is_day() ) { echo ' / '; the_time( 'F jS Y' ); } elseif ( is_month() ) { echo ' / '; the_time( 'F Y' ); } elseif ( is_year() ) { echo ' / '; the_time( 'Y' ); } elseif ( is_author() ) { echo ' / '; the_author(); } elseif ( is_search() ) { echo ' / ' . __( 'Search Results', 'best' ); } elseif ( is_404() ) { echo ' / ' . __( 'Page not found', 'best' ); } if ( isset( $_GET[ 'paged' ] ) && ! empty( $_GET[ 'paged' ] ) ) { /* if it is a page of the post list */ if ( ! is_front_page() ) { /* if it is not home page add hyphen before 'page' */ $symbol_before_page = ' / '; } else { $symbol_before_page = ''; } echo $symbol_before_page; _e( 'Page ','best' ); echo $_GET[ 'paged' ]; } } /* output function posts */ function best_posts() { $num_posts = wp_count_posts( 'post' ); $num_posts = $num_posts->publish; /*publish, draft */ $num_posts = sprintf( _n( '%s', '%s', $num_posts ), number_format_i18n( $num_posts ) ); if ( !is_single() ) { echo $num_posts . ' ' . __( 'Posts', 'best' ); } } /* caption text */ function best_the_post_thumbnail_caption() { global $post; $thumbnail_id = get_post_thumbnail_id( $post->ID ); $thumbnail_image = get_posts( array( 'p' => $thumbnail_id, 'post_type' => 'attachment' ) ); if ( $thumbnail_image && isset( $thumbnail_image[0] ) ) { if( $thumbnail_image[0]->post_excerpt !="" ){ echo '

'. $thumbnail_image[0] -> post_excerpt .'

'; } } } /* functions file enables you to customize the read more link text */ function best_modify_read_more_link() { return '' . __( 'More Link', 'best' ) . ''; } function best_header_style() { $text_color = get_header_textcolor(); $display_text = display_header_text(); if ( $text_color == HEADER_TEXTCOLOR )/* If no custom options for text are set, return default. */ return; /* If optins are set, we use them */ ?> <?php wp_title( '|', true, 'right' ); ?>