WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
[Plugin: WordPress Popular Posts] include custom post types? (4 posts)

  1. cpkid2
    Member
    Posted 3 years ago #

    Anyway to include custom post types into the list?

  2. cpkid2
    Member
    Posted 3 years ago #

    I noticed that if I add pages=1 to the list of attributes, it shows everything including the posts in my custom post types and pages. However, if I use pages=0, it only shows the posts in the default post type. Is there a way to only get rid of the actual pages?

  3. cpkid2
    Member
    Posted 3 years ago #

    I found that on line 496, changing post to another post type worked. So how can I add in an array of post types? I'm not much of a coder so I'm not sure how I'd put it in.

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

  4. cpkid2
    Member
    Posted 3 years ago #

    Ok, I got some help and found the solution.

    Around line 496, change this:

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

    To this:

    $nopages = "AND $wpdb->posts.post_type IN ('post','videos','projects')";

    With videos and projects being the custom post types.

    Hope this helps someone out there.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic