-
AuthorPosts
-
June 18, 2018 at 4:35 pm #974352
Hi!
It’s done!
Best RegardsJune 20, 2018 at 12:24 pm #975237Hi,
Thanks for the update.
We modified the filter a bit. It seems to be working as expected. Let us know if you find any issues with it.
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['same_category'] = true;} return $settings; } function avf_post_nav_get_terms($id) { $post_terms = get_the_terms($id, 'portfolio_entries'); $includes = array(); if(!empty($post_terms)) { foreach($post_terms as $term) { if ($term->parent !== 0) { $includes[] = $term->term_id; } } } $ids = implode( ',', $includes ); return $ids; } function avf_previous_post_where() { global $post, $wpdb; $ids = avf_post_nav_get_terms($post->ID); return $wpdb->prepare( "WHERE p.post_date < %s AND p.post_type = %s AND tt.term_id IN (" . $ids . ") AND p.post_status = 'publish'", $post->post_date, $post->post_type); } add_filter( 'get_previous_post_where', 'avf_previous_post_where'); function avf_next_post_where() { global $post, $wpdb; $ids = avf_post_nav_get_terms($post->ID); return $wpdb->prepare( "WHERE p.post_date > %s AND p.post_type = %s AND tt.term_id IN (" . $ids . ") AND p.post_status = 'publish'", $post->post_date, $post->post_type); } add_filter( 'get_previous_post_sort', 'avf_previous_post_sort'); function avf_previous_post_sort() { global $post, $wpdb; return "ORDER BY p.post_date desc LIMIT 1"; } add_filter( 'get_next_post_where', 'avf_next_post_where'); function avf_next_post_sort() { global $post, $wpdb; return "ORDER BY p.post_date asc LIMIT 1"; } add_filter( 'get_next_post_sort', 'avf_next_post_sort');
Best regards,
IsmaelApril 28, 2020 at 7:03 pm #1207929Hi, same issues again. Where should the code in?
Funktions.php?April 30, 2020 at 8:47 pm #1208637 -
AuthorPosts
- You must be logged in to reply to this topic.