Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1122114

    Hello,
    i wonder how to let the next/back navigation only work within the give categories.
    I allready added this code to my functions.php:

    add_filter('avia_post_nav_categories', 'use_same_category_filter');
    function use_same_category_filter($same_category){
    	$same_category = true;
    	return $same_category;
    }

    but it seems not to work.

    For example i want to make a digital guestmap where hotelgueast have everything they need on a page. This “pages” will be osed as a progressive webapp so the user should have no possability to switch to the “main content” for this it is nessecary to let the “arrow navigation” only navigate between the given category of my post-entries which i called “guest-map”.

    Is there currently any solution for this problem, as i read about that the above filter won’t work with any customs post types.

    for all with the same problem i solved it like this for now on (but i am not happy with this, because i want to use the navigation ;) )

    1.) Add this code to the functions.php to get the category name as a class on your body

    //add class to body on categories
    add_filter('body_class','add_category_to_single',10,2);
    function add_category_to_single($classes, $class) {
        if (is_single() ) {
            global $post;
            foreach((get_the_category($post->ID)) as $category) {
                $classes[] = $category->category_nicename;
            }
        }
        return $classes;
    }

    2.) In your CSS add following code:

    .YOUR-Category-Class .avia-post-nav{
    	display: none
    }
    • This topic was modified 5 years, 4 months ago by EcoTec.
    #1122712

    Hey EcoTec,

    Thank you for using Enfold.

    The filter above is invalid. The correct filter to use is called “avia_post_nav_settings”.

    Example: https://kriesi.at/support/topic/next-and-previous-post-arrows-missing-for-the-events-calendar/#post-1084301

    Replace the “taxonomy” value with the one you’ve created for your custom post type.

    Best regards,
    Ismael

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