Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #418276

    I added the following lines of code to functions.php so the Blog Posts builder block can be used to display posts from a custom post type called “recipes”.

    add_theme_support('add_avia_builder_post_type_option');
    add_theme_support('avia_template_builder_custom_post_type_grid');

    On the page where I plan to display these posts, I did NOT select a custom taxonomy term because I want to display all posts of this type. This is much the same as might be done on a blog archive page.

    If there are posts to be displayed, the page looks fine. But if there are no posts of the custom post type to display, the system displays all kinds of other posts that are unrelated to the selected custom post type. Is this a bug? I would think it would display a message saying that no posts of the selected type were found.

    Thanks!
    kcm

    #418808

    Hey Kevin!

    You have to create a taxonomy and select it in the shortcode options. If you do not choose any taxonomy then all posts will be displayed by default. If you have created a taxonomy for your post type then you can select it in the blog posts shortcode like so.

    Best regards,
    Elliott

    • This reply was modified 9 years, 7 months ago by Elliott.
    #419629

    Okay. Thanks for the response. It could just be me but this seems strange. I feel like if the user is trying to view (let’s say) recipes and there aren’t any that a “nothing found” message is a lot more appropriate than displaying blog posts. You know?

    Anyway, thanks for a great theme in any case!

    #420172

    Hi!

    Create a custom taxonomy but don’t create any posts within that taxonomy. Select the taxonomy to display on the blog posts element. It will show the no posts or nothing found warning. If you didn’t select any taxonomy, it will show all posts within the category taxonomy by default.

    Best regards,
    Ismael

    #420861

    Thanks for your reply, Ismael. I get what you’re saying but it doesn’t quite do what I wanted. I want to have a page that will display all of a particular post type (regardless of taxonomy) if there are posts so that when there are posts, they will start showing up but until then there will be a blank page essentially. It sounds like the blog posts block can’t do that. I’ll just tell my client not to publish the page until he has something to show on it.

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Using avia builder "blog posts" block for custom post types’ is closed to new replies.