I want to display featured image caption in a paragraph only if it exists.
I am trying the following without luck:
<?php if (the_post_thumbnail_caption()) { echo '<p class="wp-caption-text">' . the_post_thumbnail_caption() . echo '</p>' } ?>
and it's resulting in fatal error:
C:\xampp\htdocs\builder\wp-content\them开发者_JAVA百科es\BuilderChild-Default\extensions\magazine-enhanced2\functions.php:88:syntax error, unexpected T_ECHO
Please help.
You have redundant . echo
near '</p>'
. This should be:
<?php
if (the_post_thumbnail_caption()) {
echo '<p class="wp-caption-text">' . the_post_thumbnail_caption() . '</p>';
}
?>
精彩评论