Support » Plugin: Flexible Posts Widget » When getting posts by ID, one post does not show in widget

  • Resolved Catia

    (@catiarocha)


    I am trying to create a “related posts” widget that will be manually updated.

    I have 1 custom post type called “press releases” and I would like one post from there, and one regular blog post to be included in the list.

    I am getting posts by IDs and inserting the single ID’s from both of those posts. When I view the widget on the front-end, I only see the regular blog post showing up.

    Does “get post by ID” only support one post type at a time?
    Not sure how to go about troubleshooting this?

    Thanks!

    https://wordpress.org/plugins/flexible-posts-widget/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author DaveE

    (@dpe415)

    Hi catia.rocha,

    FPW will pull posts from any public post type when using the ID’s. However, the posts do have to be Published in order to appear. Private & Draft posts (from any post type) won’t get displayed.

    Cheers!

    Hi Dave,

    All of the posts are published. Is there anything else that could cause this?

    Thanks

    Plugin Author DaveE

    (@dpe415)

    Does the widget show posts from your Press Releases post type using one of the other settings tabs, Get posts by Post Type, for example?

    Also, does it pull a combination of a Page and Post if you set ID’s from one of each of these?

    I’m 100% sure that it does work with combined post types for the ID tab. I’m using it on several sites that way.

    It works with both press releases and posts if I’m using it on another tab, yes. It just doesn’t seem to work when I use the “get by ID” tab.

    It works with both a regular post and a page when I select it by IDs. But if I were to select a page and a press release post it does not display the post. It also works with my other custom post type (events), it just doesn’t seem to work with press releases.

    The only difference I can see between the two post types is that events is hierarchical and press releases is not.

    Could that be the reason?

    Plugin Author DaveE

    (@dpe415)

    Strange indeed. The hierarchical taxonomy shouldn’t matter, no.

    Is the site online somewhere where I can get access to it? If so, feel free to private message me on Twitter with login information (both a WordPress admin and FTP) and I can take a closer look.

    We’ll get it figured out!

    Plugin Author DaveE

    (@dpe415)

    Closing as unresponsive. Feel free to post again if you continue to have trouble.

    Hi,

    I know this is closed, but in case someone get here from google search or something. The issue is that when you have specified IDs and it’s from custom post type, you need to make sure that ‘exclude_from_search’ is set to false in custom post type declaration.

    I saw that WP_Query is created with $query_args[‘post_type’] = ‘any’; where in documentation http://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters we have:

    Display ‘any’ post type (retrieves any type except revisions and types with ‘exclude_from_search’ set to TRUE):

    I had mine custom post excluded from search and thats why didnt get any posts.

    Plugin Author DaveE

    (@dpe415)

    Hi Kokers,

    This is true. FPW doesn’t query non-public post types. This is intentional. If a post type is registered as non-public, that should be queried on the front-end. See the register_post_type reference.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘When getting posts by ID, one post does not show in widget’ is closed to new replies.