WordPress.org

Ready to get started?Download WordPress

Forums

Special Recent Posts
Using the special_recent_posts PHP call with custom post type (8 posts)

  1. snowbelly
    Member
    Posted 1 year ago #

    Hi - love this plugin. I'd like to use the special_recent_posts PHP function, but would specifically like to restrict it to one custom post type ("article_type"). Is there a way to pass parameters to the PHP function? Can you provide a list of all acceptable arguments?

    Thanks!

    http://wordpress.org/extend/plugins/special-recent-posts/

  2. snowbelly
    Member
    Posted 1 year ago #

  3. snowbelly
    Member
    Posted 1 year ago #

    Okay, I'm back again - found everything on that list except the custom post type parameter. Can it be passed?

  4. Luca Grandicelli
    Member
    Plugin Author

    Posted 1 year ago #

    // Filter post by Custom Post Type (default: none)
    'custom_post_type' => comma separated list of custom post types

  5. snowbelly
    Member
    Posted 1 year ago #

    Gave it a try, but it still returns all posts, not just my custom post type. Does this look right to you?

    $sp_args = array( 'custom_post_type' => 'article_type', 'orderby' => 'date', 'order' => 'DESC' );

    special_recent_posts($sp_args);

  6. snowbelly
    Member
    Posted 1 year ago #

    Just tried it with only the "custom_post_type" parameter and it still returns all posts. :(

  7. snowbelly
    Member
    Posted 1 year ago #

    I think I have solved it - I must be using an older version of the plugin, the parameter it wanted was srp_custom_post_type_option. Then it worked!

  8. Luca Grandicelli
    Member
    Plugin Author

    Posted 1 year ago #

    @snowbelly So you are trying to filter posts by a ustom post type called "article_type" and this works only in the prior versions of the plugin? If you put a wrong custom post type in the relative field it should not return all posts but none.

    I've just tried by myself to do some filtering and it works.
    What are the versions you used to do this test?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.