Viewing 4 posts - 31 through 34 (of 34 total)
  • Author
    Posts
  • #974352

    Hi!
    It’s done!
    Best Regards

    #975237

    Hi,

    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,
    Ismael

    #1207929

    Hi, same issues again. Where should the code in?
    Funktions.php?

    #1208637

    Hi,

    Thank you for the update. Yes, you have to add the code in the functions.php file — preferably in the child theme directory. Let us know if you need anything else.

    Best regards,
    Ismael

Viewing 4 posts - 31 through 34 (of 34 total)
  • You must be logged in to reply to this topic.