tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function pingraphy_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
}
global $page, $paged;
// Add the blog name.
$title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description";
}
// Add a page number if necessary.
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( esc_html__( 'Page %s', 'pingraphy' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'pingraphy_wp_title', 10, 2 );
/**
* Title shim for sites older than WordPress 4.1.
*
* @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
* @todo Remove this function when WordPress 4.3 is released.
*/
function pingraphy_render_title() {
?>
0 && is_array($links)) {
?>
ID);
$arr_tags = array();
foreach($tags as $tag) {
array_push($arr_tags, $tag->term_id);
}
if (!empty($arr_tags)) {
$args = array(
'tag__in' => $arr_tags,
'post__not_in' => array($post->ID),
'posts_per_page'=> $numberRelated,
);
}
} else {
$args = array(
'category__in' => wp_get_post_categories($post->ID),
'posts_per_page' => $numberRelated,
'post__not_in' => array($post->ID)
);
}
if (! empty($args) ) {
$posts = get_posts($args);
if ($posts) {
if (ot_get_option('display-related-posts') == 'thumbnail') :
?>
$count, 'error' => 0);
wp_send_json($favor);
exit;
}
add_action('wp_ajax_pingraphy_post_favor', 'pingraphy_post_favor'); // for logged in user
add_action('wp_ajax_nopriv_pingraphy_post_favor', 'pingraphy_post_favor');
/**
|------------------------------------------------------------------------------
| Get post favors
|------------------------------------------------------------------------------
|
*/
function pingraphy_get_post_favor($post_ID) {
$count_key = 'post_favor_count';
$count = get_post_meta($post_ID, $count_key, true);
if($count == ''){
return 0;
} else {
return $count;
}
}