Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

odie2 on "previous/next_post_link post format when post has no format"

$
0
0

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 all articles
Browse latest Browse all 8245

Trending Articles