Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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.

    #1423753

    Hey 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,
    Ismael

    #1423785

    next 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_framework

    #1423789

    Hey,

    Thanks for the heads up. I fixed the broken link :)

    Regards,
    Yigit

    #1423826

    Hi,

    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ünter

    #1423846

    it 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?

    #1424004

    Hi,

    The code is limited to pages and posts. For next release I will add this to core also for any CPT.

    Best regards,
    Günter

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