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() { ?> <?php wp_title( '|', true, 'right' ); ?> 0 ? intval (get_theme_mod('pingraphy_general_excerpt_lengh')) : $length; return $number; } add_filter( 'excerpt_length', 'pingraphy_excerpt_length', 999 ); function pingraphy_excerpt_more( $more ) { return get_theme_mod('pingraphy_general_excerpt_end_text', '...'); } add_filter('excerpt_more', 'pingraphy_excerpt_more'); /** |------------------------------------------------------------------------------ | Social Links |------------------------------------------------------------------------------ | */ function pingraphy_social_links() { $fb = esc_url(get_theme_mod('pingraphy_socials_facebook')); $tw = esc_url(get_theme_mod('pingraphy_socials_twitter')); $gplus = esc_url(get_theme_mod('pingraphy_socials_gplus')); $in = esc_url(get_theme_mod('pingraphy_socials_linkedin')); $yt = esc_url(get_theme_mod('pingraphy_socials_youtube')); ?>
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) { ?> %2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( esc_html_x( 'Posted on %s ', 'post date', 'pingraphy' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'By %s', 'post author', 'pingraphy' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $posted_on . ''; echo '' . $byline . ''; } endif; /** |------------------------------------------------------------------------------ | Custom Post Meta |------------------------------------------------------------------------------ | */ function pingraphy_footer_post_meta() { ?>
'; comments_popup_link( esc_html__( '0', 'pingraphy' ), esc_html__( '1', 'pingraphy' ), esc_html__( '%', 'pingraphy' ) ); echo ''; } ?>
$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; } }