Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #733191

    Hi,
    I followed this post to add a custom post type: https://kriesi.at/support/topic/procedure-for-adding-custom-post-type-and-enabling-it-for-use/

    Posts are not made in Avia builder and I have to categories: Lopende projecten and opgeleverde projecten.

    When using the next and previous buttons on a post I would like the next or previous post to be from the same categorie.

    I searched the forum and found a lot of solutions, all codes below I have tried but non is working.

    What can I do to get it working in the same categorie.

    url: http://bloemfontein.nl/nw16/projecten/lopende-projecten/ and http://bloemfontein.nl/nw16/projecten/opgeleverde-projecten/
    I am using a Child theme

    Thanks in advance.

    Codes used:
    With this one the buttons dissappear

    add_filter( 'avia_post_nav_settings', 'enfold_customization_same_cat' );
    function enfold_customization_same_cat( $s ) {
    	$s['same_category'] = true;
    	return $s;
    }

    This one also the buttons dissappear

    add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
    function avia_same_category_filter($settings) {
         $settings['same_category'] = true;
         return $settings;
    }

    This one doesn’t work at all

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

    This one doesn’t work and the previous button is pointing to the same post as where you are:

    add_filter('avia_post_nav_entries','avia_same_category_filter', 10, 1);
    function avia_same_category_filter($settings) {
         $settings['same_category'] = true;
         return $settings;
    }
    #734580

    Hey ariane1001,

    Thank you for using Enfold.

    The pages do not exist. Are you using the portfolio items? Please remove all modifications then add this in the functions.php file:

    add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod');
    function avia_post_nav_settings_mod($settings)
    {
      if(is_singular('portfolio')) {
        $settings['taxonomy'] = 'portfolio_entries';
    	$settings['is_fullwidth'] = false;
      }
    	$settings['same_category'] = true;
    	return $settings;
    }

    Best regards,
    Ismael

    #734606

    Hi Ismael,

    Thanks for your answer.
    The site went live and is now on http://bloemfontein.nl/projecten/lopende-projecten/ and http://bloemfontein.nl/projecten/opgeleverde-projecten/

    There are not portfolio items but a custom post type: projecten. I altered the code, see below, and it works.

    add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod');
    function avia_post_nav_settings_mod($settings)
    {
      if(is_singular('project')) {
        $settings['taxonomy'] = 'projecten';
    	$settings['is_fullwidth'] = false;
      }
    	$settings['same_category'] = true;
    	return $settings;
    }

    Thank you very much!
    Ariane

    #734726

    Hi,

    Great, glad we could help :-)

    Please let us know if you should need any further help on the topic.

    Best regards,
    Rikard

    #916903

    Hi Rikard!
    Perfect, it worked! Thank you!

    #917023

    Hi trconnected,

    Great, glad you got it working and thanks for sharing.

    Best regards,
    Rikard

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