[Resolved] Bug display next/previous button category visual portfolio

Home Forums Support [Resolved] Bug display next/previous button category visual portfolio

Home Forums Support Bug display next/previous button category visual portfolio

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

    Hello,

    I use the Visual portfolio plugin and on my posts I can’t display the next and previous posts. According to what I see https://wordpress.org/support/topic/next-and-previous-post-links-2/ this is due to the theme setting.

    I added this

    add_action( 'generate_before_footer', 'tu_custom_post_type_post_nav' ); function tu_custom_post_type_post_nav() {
    	if ( 'portfolio_category' == get_post_type() ) : ?> 		
        <footer class="entry-meta">
    			<?php generate_entry_meta(); ?>
    			<?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
    		</footer><!-- .entry-meta -->
    	<?php endif;
     };

    but it doesn’t change anything. In my dasboard it’s well set though and I see the links on another category

    Alexis
    agency K-LYA

    #1681144
    Elvin
    Staff
    Customer Support

    Hi there,

    I’ve inspected your site and the post type specified on the snippet’s condition doesn’t seem to match the post type slug.

    Can you try removing _category in if ( 'portfolio_category' == get_post_type() ) ?

    Let us know.

    A wise man once said:
    "Have you cleared your cache?"

    #1681693
    alexis

    ok it works thank you. And I want to change the button texts. I’ve added all this, but I need to have something duplicate because I have the previous and next navigation bar twice.

    add_action( 'generate_before_footer', 'tu_custom_post_type_post_nav' ); function tu_custom_post_type_post_nav() {
    	if ( 'portfolio' == get_post_type() ) : ?> 		
        <footer class="entry-meta">
    			<?php generate_entry_meta(); ?>
    			<?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
    		</footer><!-- .entry-meta -->
    	<?php endif;
     };
    
     add_filter( 'next_post_link', function( $output, $format, $link, $post ) {
        if ( ! $post ) {
        return '';
      }
    
      return sprintf(
          '<div class="nav-next"><span class="next"><a href="%1$s" title="%2$s">Mariage suivant</a></span></div>',
            get_permalink( $post ),
            $post->post_title
      );
    }, 10, 4 );
    
    add_filter( 'previous_post_link', function( $output, $format, $link, $post ) {
        if ( ! $post ) {
        return '';
      }
    
      return sprintf(
          '<div class="nav-previous"><span class="prev"><a href="%1$s" title="%2$s">Mariage précédent</a></span></div>',
            get_permalink( $post ),
            $post->post_title
      );
    }, 10, 4 );

    Alexis
    agency K-LYA

    #1682542
    Elvin
    Staff
    Customer Support

    You can try adding this PHP snippet so the default pagination doesn’t show on portfolio posts types.

    add_filter( 'generate_show_post_navigation', function(){
    if ( 'portfolio' == get_post_type() ){
    return false;
    }
    } );

    A wise man once said:
    "Have you cleared your cache?"

    #1682901
    alexis

    Thanks, perfect !

    Alexis
    agency K-LYA

    #1686001
    Elvin
    Staff
    Customer Support

    No problem. 🙂

    A wise man once said:
    "Have you cleared your cache?"

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