February 17, 2021 at 5:01 am #26917
How can I disable the ‘Sorry, no posts found’ message, so that if there are no posts assigned to the category that ShowPosts is set to display it doesn’t return anything?
My use case is this:
For a client I have a shortcode block setup with showposts set to display the latest post assigned to the ‘announcement’ category. The block is positioned on the homepage where an announcement can be made, when my client wants to. Most of the time, this block will be empty. The idea being, if they want to make an announcement they simply write a post and assign it to the announcement category, and clear the category if they want to remove it.
The problem with this is that when no posts are assinged, showposts returns the ‘Sorry, not posts found’ message
Any ideas?February 17, 2021 at 5:00 pm #26954
I’ve done some more experimenting around this, and have found a workaround, but I also think I may have stumbled upon a bug.
First of all the workaround:
In ‘More Settings’ within the individual list, find ‘No results message’. If this is empty then ‘Sorry, no posts found’ is displayed on the live page.
To get rid of the message simply put a space in the field and save.
This is a little problematic as it’s not easy to see the different with the eye, but it works. It might be worth considering pre-populating the field with ‘Sorry, no posts found’ and then have it not return any output if the field is empty.
Now on to a possible bug:
When implementing the above a list was built set to display posts from the category ‘ announcement ‘, to create the list I had to assign this category to a post, I couldn’t assign an existing category to a list if there wasn’t any posts assigned to it. So figuring that out all looks good.
My list is created, I add the space to the ‘ No results message ‘ to get it to return no output if no posts have the announcement category assigned to it, then to test this is working as intended I remove the announcement category from the one post which has it. I load the page – bingo, no message or output from showposts. I re add the announcement category to the post, and reload the live page, and the post appears in the right place. I then remove the category from the post again as I expect my client to do when there is no need for an announcement. Note – category still exists. I go into ShowPosts and make an unrelated change – anything color or anyother setting (not anything to do with category selection) , and save. It then saves without any category applied. So if a post has the announcment category reapplied, it no longer appears on the site.
Saving a list set to show posts from a category, which still exists, but no longer has any posts assigned to it – removes that category from the list, so its function no longer works even when a post has the category applied to it in the future.February 17, 2021 at 10:27 pm #26965
This is a replicable bug on the official release that is addressed on the Alpha version.
Tweak: Show empty categories in taxonomy list
Is included on the changelogs.
You can try the latest alpha version out and test it if you’d like. 😀
As for when the official 1.2.0 release date, Tom has yet to announce a schedule for it but we will make sure to give a heads up when it’s ready. 😀February 19, 2021 at 4:27 am #27036
Thank you, the 1.2.0 alpha does indeed fix the empty category issues and looks good.
I wouldn’t normally consider using an alpha on a live site, but it seems to work well. Is it stable enough to use on a live site? Are there any problems reported?February 21, 2021 at 10:12 pm #27108
We’ve yet to find ones aside from the known bugs from previous versions like having multiple WPSP list in one page with pagination, masonry and/or carousel enabled.
But we really can’t recommend using it as there’s no telling what could go wrong considering each site’s unique mix of plugins.
And my apologies for being unable to give out a set date for the official release. Tom’s pretty busy with the next big release for GeneratePress (3.1.0) and premium.
It’s target release date is Early/Mid March and if all goes as planned, Tom should be able to give out the date for WPSP as well after that.February 22, 2021 at 11:18 am #27141
Thank you for the reply. So much excitement for your range of products, can’t wait!February 22, 2021 at 10:41 pm #27197
No problem. We’ll make sure to keep you posted. Please look forward to it. 😀
- You must be logged in to reply to this topic.