I`d like to do this:
<a href="...">
<img src="..." />
<h5>Older Post</h5>
<p>Titel</p>
</a>
<?php next_post_link('%link', "$prevthumbnail __('<h5>Older Post</h5>'),
<p>%title</p>", TRUE); ?>
but doesn´t work at all. I´ve some syntax problems to combine PHP (WordPress translation) and HTML:
Thanks for your help
Ogni
<?php next_post_link('%link', "$nextthumbnail", TRUE); ?>
<?php next_post_link('%link', __("<span class='header'>Older post</span>", "SCNR"), TRUE); ?>
<?php next_post_link('%link', "<span>%title</span>", TRUE); ?>
You need some serious help, try this instead.
<?php
//connect to database and set variables or whatever
$link = "http://foo.bar";
$prevthumbnail = "img/foo.png";
$title = "The Foo Bar";
//then print this...
echo '<a href="'.$link.'"><img src="'.$prevthumbnail.'" /><h5>Older Post</h5><p>'.$title.'</p></a>';
?>
This is untested, but it should work for what you need. Instead of using the next_post_link()
function which was really meant for simpler links, we're building the link on our own.
<?php
// Gets the ID of the next post in the same term
$next_post = get_next_post( true );
// If that ID exists...
if ( ! empty( $next_post ) ) :
?>
<a href="<?php echo get_permalink( $next_post ); ?>">
<?php echo get_the_post_thumbnail( $next_post ); ?>
<h5><?php _e( 'Older Post', 'textdomain' ); ?></h5>
<p><?php echo get_the_title( $next_post ); ?></p>
</a>
<?php endif; ?>