• Hello,

    I am using at end of post, navigation to previous and next post of certain post type.

    <?php
    
    if ( is_page() ) :
    
        previous_post_link( '%link', __( '<span class="meta-nav">Previous Page</span>%title', 'twentyfourteen' ) );
        next_post_link( '%link', __( '<span class="meta-nav">Next Page</span>%title', 'twentyfourteen' ) );
    
    elseif ( false !== get_post_format() ) :
    
        previous_post_link( '%link', __( '<span class="meta-nav">Previous '. ucfirst( get_post_format() ) .'</span>%title', 'twentyfourteen' ), TRUE, ' ', 'post_format' );
        next_post_link( '%link', __( '<span class="meta-nav">Next '. ucfirst( get_post_format() ) .'</span>%title', 'twentyfourteen' ), TRUE, ' ', 'post_format' );
    
    else :
    
        previous_post_link( '%link', __( '<span class="meta-nav">Previous Post</span>%title', 'twentyfourteen' ) );
    
        next_post_link( '%link', __( '<span class="meta-nav">Next Post</span>%title', 'twentyfourteen' ) );
    
    endif;
    
    ?>

    But when post has no format, get_post_format() returns false and as I checked in core, there are no any trick, even with filters on wp_get_object_terms as it’s getting results from on _term_relationships.

    I just would to:

    <- Prev Gallery | Current Gallery | Next Gallery ->
    <- Prev No-Format Post | Current No-Format Post | Next No-Format Post ->

    I could even use any plugin if exists.

    Thanks in advance!
    Greetings

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘previous/next_post_link post format when post has no format’ is closed to new replies.