have_posts()) : $my_query->the_post(); ?>
Rated22 Copyright © .
'secondary-menu', 'menu_class' => 'menu menu-footer clearfix' ) ); ?>
';
if (is_single()) {
$categories = get_the_category();
if ( $categories ) {
$level = 0;
$hierarchy_arr = array();
foreach ( $categories as $cat ) {
$anc = get_ancestors( $cat->term_id, 'category' );
$count_anc = count( $anc );
if ( 0 < $count_anc && $level < $count_anc ) {
$level = $count_anc;
$hierarchy_arr = array_reverse( $anc );
array_push( $hierarchy_arr, $cat->term_id );
}
}
if ( empty( $hierarchy_arr ) ) {
$category = $categories[0];
echo '
';
} else {
foreach ( $hierarchy_arr as $cat_id ) {
$category = get_term_by( 'id', $cat_id, 'category' );
echo '
';
}
}
}
echo "";
the_title();
echo "
";
} elseif (is_page()) {
global $post;
if ( $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = '
';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse( $breadcrumbs );
foreach ( $breadcrumbs as $crumb ) { echo $crumb; }
}
echo "";
the_title();
echo "
";
} elseif (is_category()) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$this_cat_id = $cat_obj->term_id;
$hierarchy_arr = get_ancestors( $this_cat_id, 'category' );
if ( $hierarchy_arr ) {
$hierarchy_arr = array_reverse( $hierarchy_arr );
foreach ( $hierarchy_arr as $cat_id ) {
$category = get_term_by( 'id', $cat_id, 'category' );
echo '
';
}
}
echo "";
single_cat_title();
echo "
";
} elseif (is_author()) {
echo "";
if(get_query_var('author_name')) :
$curauth = get_user_by('slug', get_query_var('author_name'));
else :
$curauth = get_userdata(get_query_var('author'));
endif;
echo esc_html( $curauth->nickname );
echo "
";
} elseif (is_search()) {
echo "";
the_search_query();
echo "
";
} elseif (is_tag()) {
echo "";
single_tag_title();
echo "
";
}
}
}
/*------------[ schema.org-enabled the_category() and the_tags() ]-------------*/
function mts_the_category( $separator = ', ' ) {
$categories = get_the_category();
$count = count($categories);
foreach ( $categories as $i => $category ) {
echo 'name ) ) . '" ' . ' itemprop="articleSection">' . esc_html( $category->name ).'';
if ( $i < $count - 1 )
echo $separator;
}
}
function mts_the_tags($before = null, $sep = ', ', $after = '') {
if ( null === $before )
$before = __('Tags: ', 'wpneon');
$tags = get_the_tags();
if (empty( $tags ) || is_wp_error( $tags ) ) {
return;
}
$tag_links = array();
foreach ($tags as $tag) {
$link = get_tag_link($tag->term_id);
$tag_links[] = '' . esc_html( $tag->name ) . '';
}
echo $before.join($sep, $tag_links).$after;
}
/*------------[ pagination ]-------------*/
if (!function_exists('mts_pagination')) {
function mts_pagination($pages = '', $range = 3) {
//$mts_options = get_option(MTS_THEME_NAME);
// traditional or ajax pagination
?>
ID);
if (empty($tags)) {
$empty_taxonomy = true;
} else {
$tag_ids = array();
foreach($tags as $individual_tag) {
$tag_ids[] = $individual_tag->term_id;
}
$args = array( 'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page' => $mts_options['mts_related_postsnum'],
'ignore_sticky_posts' => 1,
'orderby' => 'rand'
);
}
} else {
// related posts based on categories
$categories = get_the_category($post->ID);
if (empty($categories)) {
$empty_taxonomy = true;
} else {
$category_ids = array();
foreach($categories as $individual_category)
$category_ids[] = $individual_category->term_id;
$args = array( 'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page' => $mts_options['mts_related_postsnum'],
'ignore_sticky_posts' => 1,
'orderby' => 'rand'
);
}
}
if (!$empty_taxonomy) {
$my_query = new WP_Query( $args ); if( $my_query->have_posts() ) {
echo '';
echo '
'.__('Related Posts','wpneon').'
';
echo '
'; ?>
'; }} wp_reset_postdata(); ?>
$meta ) { mts_the_postinfo_item( $key ); } ?>
•
•
$button ) { mts_social_button( $key ); } ?>
Share on Facebook
Pin It
element ]-------------*/
if ( ! function_exists( 'mts_article_class' ) ) {
function mts_article_class() {
$mts_options = get_option( MTS_THEME_NAME );
$class = '';
// sidebar or full width
if ( mts_custom_sidebar() == 'mts_nosidebar' ) {
$class = 'ss-full-width';
} else {
$class = 'article';
}
echo $class;
}
}
/*------------[ Class attribute for #page element ]-------------*/
if ( ! function_exists( 'mts_single_page_class' ) ) {
function mts_single_page_class() {
$class = '';
if ( is_single() || is_page() ) {
$class = 'single';
$header_animation = mts_get_post_header_effect();
if ( !empty( $header_animation )) $class .= ' '.$header_animation;
}
echo $class;
}
}