Tagged: avia post nav
-
AuthorPosts
-
June 25, 2014 at 7:00 am #283424
Hello,
I’m using the Enfold theme portfolio post type and I have 2 different categories set up: one for “Film”, and one for “Commercial”.
I’d like to use the avia post nav tabs to navigate between only portfolio items that have been categorized under “Film” when viewing viewing “Film” projects. I’d also like to have the same behavior for portfolio items that are categorized as “Commercial”. Unfortunately, the post nav tabs are navigating between all portfolio posts regardless of category.
Is there any way to set this kind of behavior up, or to at least have the post nav tabs navigate through all “Film” categorized portfolio posts before navigating through portfolio posts of another category? right now it’s just going through all portfolio posts in order of oldest to newest without looking at the category.
June 25, 2014 at 10:14 am #283467Hey!
Refer to this topic:
https://kriesi.at/support/topic/avia-post-nav-with-the-same-category/Cheers!
JosueJune 27, 2014 at 4:10 am #284378Hi Josue,
And thanks for the direction!
I also needed to customize some of the text in the <h4 class=’proj-nav-title’> of the post nav tabs so I ended up copying the whole
avia_post_nav function into my child theme’s functions.php to do that customization and then set $same_category parameter to “true”:if(!function_exists('avia_post_nav')) { function avia_post_nav($same_category = true, $taxonomy = 'category') { global $wp_version; $settings = array(); $settings['same_category'] = $same_category; $settings['excluded_terms'] = ''; $settings['wpversion'] = $wp_version; //dont display if a fullscreen slider is available since they overlap if((class_exists('avia_sc_layerslider') && !empty(avia_sc_layerslider::$slide_count)) || class_exists('avia_sc_slider_full') && !empty(avia_sc_slider_full::$slide_count) ) $settings['is_fullwidth'] = true; $settings['type'] = get_post_type(); $settings['taxonomy'] = ($settings['type'] == 'portfolio') ? 'portfolio_entries' : $taxonomy; if(!is_singular() || is_post_type_hierarchical($settings['type'])) $settings['is_hierarchical'] = true; if($settings['type'] === 'topic' || $settings['type'] === 'reply') $settings['is_bbpress'] = true; $settings = apply_filters('avia_post_nav_settings', $settings); if(!empty($settings['is_bbpress']) || !empty($settings['is_hierarchical']) || !empty($settings['is_fullwidth'])) return; if(version_compare($settings['wpversion'], '3.8', '>=' )) { $entries['prev'] = get_previous_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']); $entries['next'] = get_next_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']); } else { $entries['prev'] = get_previous_post($settings['same_category']); $entries['next'] = get_next_post($settings['same_category']); } $entries = apply_filters('avia_post_nav_entries', $entries, $settings); $output = ""; foreach ($entries as $key => $entry) { if(empty($entry)) continue; $tc1 = $tc2 = ""; $link = get_permalink($entry->ID); $image = get_the_post_thumbnail($entry->ID, 'square'); $class = $image ? "with-image" : "without-image"; $output .= "<a class='avia-post-nav avia-post-{$key} {$class}' href='{$link}' >"; $output .= " <span class='label iconfont' ".av_icon_string($key)."></span>"; $output .= " <span class='entry-info-wrap'>"; $output .= " <span class='entry-info'>"; $tc3 .= " <h4 class='proj-nav-title'>View Another Project</h4>"; $tc1 = " <p class='entry-title'>".avia_backend_truncate(get_the_title($entry->ID),75," ")."</p>"; if($image) $tc2 = " <span class='entry-image'>{$image}</span>"; $output .= $key == 'prev' ? $tc3.$tc1.$tc2 : $tc2.$tc3.$tc1; $output .= " </span>"; $output .= " </span>"; $output .= "</a>"; } return $output; } }
June 27, 2014 at 4:17 am #284384Great, if you have any additional question please let me know.
Best regards,
JosueFebruary 23, 2015 at 11:14 am #400514Hi.
Here is my test website: http://twinmotion.abvent.com/quest-ce-que-cest/
I would like to navigate within the same category posts. The category name is “Description”.
I tried the way as in the post Josue mentioned before (https://kriesi.at/support/topic/avia-post-nav-with-the-same-category/), but nothing happens.I tried the juicesandmilks’ way and it works more or less. But it is far more complex and I don’t need to customize the buttons.
Could you help me please ?
Tell me if you need more infos.
Thanks
RiccardoFebruary 23, 2015 at 4:53 pm #400771Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueFebruary 24, 2015 at 1:08 pm #401365This reply has been marked as private.February 25, 2015 at 7:13 am #401874Hey!
I’m sorry, I copied the whole avia_post_nav function to the child theme’s functions.php and it somehow broke the site because there is an excess bracket. Please override the functions.php on your child theme folder. Add this code:
Again, I’m very sorry for the inconvenience.
Regards,
IsmaelFebruary 25, 2015 at 1:12 pm #402009Nice! Thanks.
I fixed the problem.
Your code works perfectly.Thanks again.
Riccardo -
AuthorPosts
- The topic ‘Set Avia Post Nav to only navigate between posts of the same category’ is closed to new replies.