Created
January 30, 2019 10:59
-
-
Save WordPress-Handbuch/3a788cc81627a96399e3ec5429f60b59 to your computer and use it in GitHub Desktop.
PHP code extension to display post image thumbnails next to the Previous/Next post links in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$previous_post=get_previous_post(); | |
$next_post=get_next_post(); | |
the_post_navigation( | |
array( | |
'next_text' => '<span class="meta-nav" aria-hidden="true">Weiter</span> ' . | |
'<span class="screen-reader-text">Weiter</span> <br/>' . | |
'<span class="post-title">%title</span>' . get_the_post_thumbnail( $next_post->ID, 'thumbnail' ), | |
'prev_text' => '<span class="meta-nav" aria-hidden="true">Zurück</span> ' . | |
'<span class="screen-reader-text">Zurück</span> <br/>' . | |
'<span class="post-title">%title</span>' . get_the_post_thumbnail( $previous_post->ID, 'thumbnail' ), | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment