',
)
);
}
/* 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( '%3$s',
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 */ ?>