Could you tell me, why it doesn't work? This is PHP for Wordpress. I am a begginer and for me it looks totally correctly and I absolutely don't know what the problem is. This is a blog page: http://www.alexeyzyablov.com/2021/04/21/mining/ This is the bottom part, where you see 2 images, next and previous posts. Now it works, but I try to add an additional else condition:
<?php } else { ?>
<div id="clippers" class="next" style="float:left;width:50vw;">
<p>Here I need text</p>
<?php } ?>
And it writes "syntax error, unexpected '}'" on the line where
<?php } else { ?>
And if you delete "}" it writes "syntax error, unexpected 'else'".
This is the full code with the problem which doesn't work, I've only added else condition and
<?php } ?>
to the end of each condition.
<div style="width:100vw">
<?php $nextPost = get_next_post(true);
if($nextPost) { ?>
<div id="clippers" class="next" style="float:left;width:50vw;">
<p><?php next_post_link('%link', '%title', TRUE, '90'); ?></p>
<?php $nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(1000,1000) ); } ?>
<?php next_post_link('%link',"$nextthumbnail", TRUE); ?>
</div>
<?php } else { ?>
<div id="clippers" class="next" style="float:left;width:50vw;">
<p>Here I need text</p>
<?php } ?>
<?php $prevPost = get_previous_post(true);
if($prevPost) { ?>
<div id="clippers" class="previous" style="float:right; width:50vw;">
<p><?php previous_post_link('%link', '%title', TRUE, '90'); ?></p>
<?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(1000,1000) );}?>
<?php previous_post_link('%link',"$prevthumbnail", TRUE); ?>
</div>
<?php } ?>
</div>
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire