Plugin: WordPress Popular Posts > Possible to include custom post types?

I tried asking the plugin author and while waiting for a response I figured I’d give this place a try too.

This is what wordpress-popular-posts.php looks like: pastebin

Read More

Is there something I can change in there to include custom post types?

Maybe somewhere around line 132 since I’m calling the wpp_get_mostpopular function? I suppose I’d need to add custom post types to the list of arguments but I’m not sure where that would be.

Related posts

Leave a Reply

1 comment

  1. Not sure if this is the right place… but line 496

    $nopages = "AND $wpdb->posts.post_type = 'post'";
    

    seems to be the only place I see any post selection limited to just post

    When I’ve messed around with other plugins, to add in CPTs, I’v elooked for similar selection criteria. And added in my own CPTs. So the first place I would mess around is here. I’m not a coder, so I’m not sure exactly how to add in the CPT here….

    $nopages = "AND $wpdb->posts.post_type = 'post', 'cpt', 'another'";
    

    or if it has to be in an array

    $nopages = "AND $wpdb->posts.post_type = array( 'post', 'cpt', 'another' )";
    

    , or what…..

    I’m sure you know to have a backup available, and that if you get the syntax wrong, you could kill the plugin, or your site. But as long as you can ftp in, no harm no foul really. I know I’ve killed my sites a few times doing stuff like this. Its why I have a dev install of WP that is pretty much a copy of my live site…. so I can poke it with a stick to see what happens