Skip to content

Instantly share code, notes, and snippets.

@WordPress-Handbuch
Created January 30, 2019 10:59
Show Gist options
  • Save WordPress-Handbuch/3a788cc81627a96399e3ec5429f60b59 to your computer and use it in GitHub Desktop.
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
$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