[Resolved] Hide section automatically if there are no posts to show

Home Forums Support Hide section automatically if there are no posts to show

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1143799
    Encarni

    Hi there,

    Love the theme, I’m learning coding a lot 😀

    I am designing an animal shelter webpage and using sections for showing a row with a gallery of published custom posts in a specific category, with the help of WP Show Posts. This posts will move to another category at some point.

    It works like this:

    · A puppy is in adoption: post in category “In adoption” ==> It is showed in the home section “Puppies in adoption”.

    · This same puppy is adopted: the post category changes to “Adopted” ==> It disappears from the home section.

    Is there a way to hide this whole section when there is no puppies in adoption? I only get the option to show the text “Sorry, no posts were found”, but I want the whole section is gone from the homepage.

    I’ve found this thread in the forums but I’m not sure if it has something to do with my question –sorry, I’m a self-taught coder and not sure about a lot of things.

    Thank you in advance!

    #1143885
    Leo
    Staff
    Customer Support

    Hi there,

    Unfortunately the topic you found won’t work for this.

    I don’t think there is a way to achieve what you have in mind as Sections have no way of knowing is the shortcode has content or not.

    You would need to add/remove that section manually.

    #1143919
    Encarni

    Hi Leo,

    So sad to hear that.

    I will have to adapt my design and think about an alternative section for that space when there are no posts to show. It would be great to have a section library with templates ready to use in these cases. Just a suggestion… 😉

    Thanks a lot!

    #1143945
    Leo
    Staff
    Customer Support

    Thanks for your inputs!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.