• Hello, on the Stats-Tab in WP-admin at the popular posts list the stats (views and comments count) are not shown. They should because of line 228 in views/admin.php for example:
    <?php echo do_shortcode("[wpp range='all' post_type='".$this->user_settings['stats']['post_type']."' stats_comments=1 stats_views=1 order_by='".$this->user_settings['stats']['order_by']."' wpp_start='<ol>' wpp_end='</ol>' post_html='<li><a href=\"{url}\" target=\"_blank\" class=\"wpp-post-title\">{text_title}</a> <span class=\"post-stats\">{stats}</span></li>' limit=".$this->user_settings['stats']['limit']." freshness=" . $this->user_settings['stats']['freshness'] . "]"); ?>

    I think it’s because of line 1927 in wordpress-popular-posts.php:
    return apply_filters('wpp_post', $content, $p, $instance);
    Before this line the $content variable contains all data but apply_filters returns different markup. The stats are removed and the excerpt is added. If I just return $content the output in the Stats-Tab is correct.

    Regards and thanx for your help!
    Guido

    https://wordpress.org/plugins/wordpress-popular-posts/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Guido!

    Either your theme or another plugin is altering the default HTML output (probably the former) which is why you can’t see the comments count. Check if your theme is hooking into wpp_post and post the code here.

    Thread Starter Guido Handrick

    (@kito76)

    Hi Hector, thank you for your quick response. You are right, my theme has a hook for wpp_posts function.

    function regioblog_wpp_post($content, $p, $instance) {
    	if(!is_admin()) {
    		// WPML support, based on Serhat Evren's suggestion - see http://wordpress.org/support/topic/wpml-trick#post-5452607
    		if ( defined( 'ICL_LANGUAGE_CODE' ) && function_exists( 'icl_object_id' ) ) {
    			$current_id = icl_object_id( $p->id, get_post_type( $p->id ), true, ICL_LANGUAGE_CODE );
    			$permalink  = get_permalink( $current_id );
    		} // Get original permalink
    		else {
    			$permalink = get_permalink( $p->id );
    		}
    
    		$title    = get_the_title( $p->id );
    		$excerpt  = get_the_excerpt( $p->id );
    		$subtitle = get_post_meta( $p->id, 'subtitle' );
    
    		$content =
    				'<li>'
    				. '<a href="' . $permalink . '" title="' . esc_attr( $title ) . '" class="wpp-post-title">' . $title . '</a> '
    				. '<p class="wpp-excerpt">' . $subtitle[0] . '</p>'
    				. "</li>\n";
    	}
    	return $content;
    }
    add_filter('wpp_post', 'regioblog_wpp_post', 3, 3);

    I added the if(!is_admin()) as a quick fix and it’s working.

    Thanx a lot fpr your help!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Actually, I was going to suggest exactly that 🙂 Glad to know you got it solved!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Views and comments count not shown in WP-admin Stats-Tab’ is closed to new replies.