-
AuthorPosts
-
October 25, 2023 at 2:17 pm #1423689
on some customer pages i got (top-level) menu-items that shows f.e. blog-post of a given category.
is it possible to dynamically hide those menu-items if there is no post inside. The page shows in this case that message of no_criteria_matched : “Sorry, no posts matched your criteria”
It would be nice if the corresponding Menu-Items are then removed ( or hidden ) dynamically.October 26, 2023 at 9:43 am #1423753Hey Guenter,
Thank you for the inquiry.
You might be able to use the wp_ajax_{$action} function to create a script that queries a certain category and hides a specific menu item if the query returns nothing.
// https://developer.wordpress.org/reference/hooks/wp_ajax_action/
Best regards,
IsmaelOctober 26, 2023 at 2:29 pm #1423785next special question :
there is on github a wp-core snippet:
https://github.com/KriesiMedia/enfold-library/blob/master/codesnippets%2C%20tricks%2C%20plugins/WP%20Core/duplicate-posts-and-pages-without-plugins.php
btw. on your docu there is a dead link concerning to this.
It is for duplicate post/pages without plugin. It works – but portfolios are excluded from that trick.
how to include portfolios there ( or better to include a CPT )here is the pastbin page from my edited php: https://pastebin.com/AaiTX8kU
But : this is only a file that is translated inside to english where there are in original spanish terms. On those lines that are visible to users i only had insertet the option to translate strings with avia_frameworkOctober 26, 2023 at 4:03 pm #1423789October 26, 2023 at 6:22 pm #1423826Hi,
This snippet was proposed by a user and we added it to our library 1:1 in case the original post would become offline – and we did not even test it.
But I will add it to the dev repo to extend it for any post type.
Best regards,
GünterOctober 26, 2023 at 11:48 pm #1423846it is working nice – but did not involve the portfolio – and i could not find out why. Portfolio are at least posts so – where is the crux?
October 29, 2023 at 12:41 pm #1424004 -
AuthorPosts
- You must be logged in to reply to this topic.