Skip to main content
2 of 2
added 2 characters in body
nobody
  • 2.5k
  • 2
  • 27
  • 32

There isn't really enough code as an example to fully understand if there is any additional issues, but the main thing which is causing the URL's to not work is the fact that the opening anchor tag is not closed. Adding a "> to the end of the first line should fix the issue. In addition the art-PostMetadataHeader div should be closed.

<a href="<?php the_permalink(); ?>">
<?php endif; ?>
<?php $metadataContent = ob_get_clean(); ?>
<?php if (trim($metadataContent) != ''): ?>
<div class="art-PostMetadataHeader">
    <?php echo $metadataContent; ?>
</div>
</a>

Having said that, nesting a block level element such as a div inside of an inline element such as an anchor is not standards compliant, but this code would have the same effect of linking all the $metadataContent, while being standards compliant.

<?php endif; ?>
<?php $metadataContent = ob_get_clean(); ?>
<?php if (trim($metadataContent) != ''): ?>
<div class="art-PostMetadataHeader">
   <a href="<?php the_permalink(); ?>"><?php echo $metadataContent; ?></a>
</div>
nobody
  • 2.5k
  • 2
  • 27
  • 32