I have a piece of PHP code which is within a Wordpress theme that I am trying to change. I am not skilled in PHP so am having some trouble.

This is the code


<div class="portfoliobox box_small box box<?php echo $boxnumber; ?>">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>

Part 2.

<?php echo '<a href="'.$portfolio_image.'" rel="lightbox[portfolio]"><img class="aligncenter" src="'.$portfolio_image_small.'" alt="" /></a>';?>

The first part of this is fine, it display the post name and then creates a link through to the post when clicking on the post title.

It's the second part that I want to change. Currently the post image is displayed and when clicked opens in a lightbox window. However what I am trying to do is instead to show the image and when the image is clicked it goes through to the post page in the same was as clicking on the post title does in the first part of the code.

Any wordpress gurus out there?

2 answers

This was chosen as the best answer

This will link to the post and remove the lightbox functionality.

<?php echo '<a href="'.get_permalink().'"><img class="aligncenter" src="'.$portfolio_image_small.'" alt="" /></a>';?>
Answered over 7 years ago by enbuyukfener

Ah, perfect. That works a treat. Many thanks.

Answered over 7 years ago by Andrew Turner