Tagged: Custom Post Type, Next / Previous Buttons
-
AuthorPosts
-
January 13, 2017 at 4:36 pm #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 themeThanks in advance.
Codes used:
With this one the buttons dissappearadd_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; }
January 17, 2017 at 9:21 am #734580Hey 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,
IsmaelJanuary 17, 2017 at 9:54 am #734606Hi 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!
ArianeJanuary 17, 2017 at 2:49 pm #734726Hi,
Great, glad we could help :-)
Please let us know if you should need any further help on the topic.
Best regards,
RikardFebruary 23, 2018 at 10:55 pm #916903Hi Rikard!
Perfect, it worked! Thank you!February 24, 2018 at 8:28 am #917023 -
AuthorPosts
- You must be logged in to reply to this topic.