PHP override working only on one page

I’m not very bright when it comes to PHP (I’m much better and at css) but I’ve built a new website and am having an issue moving a photo caption/credit below the image (the site is based off a RocketTheme Joomla template and I’m using Joomla’s K2 extension for content).

I have created a php override to move image captions and credits below the image, which is working on this page: (see the bolded name under the image, this specific image has no caption).

However, this fix doesn’t work on any other page! For instance, see this story with an image and caption (you’ll see them kind of tucked on top of the first line of the story):

The PHP file changed is item.php and is placed in the template folder > com_k2 > Image Caption (this is a folder created for the workaround).

I’ve pasted the image part of php file below in case it helps.

My question is: Why is this working on one specific page but not any other on my site?

Thanks in advance for any help! I know this might be impossible to troubleshoot without admin access unfortunately.


  <!-- Plugins: BeforeDisplayContent -->
  <?php echo $this->item->event->BeforeDisplayContent; ?>

  <!-- K2 Plugins: K2BeforeDisplayContent -->
  <?php echo $this->item->event->K2BeforeDisplayContent; ?>

  <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
  <!-- Item Image -->
  <div class="itemImageBlock">
	  <span class="itemImage">
	  	<a class="modal" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('Click to preview image'); ?>">
	  		<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo $this->item->image_caption; else echo $this->item->title; ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
	 <?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
	  <!-- Image caption -->
	  <center><b><?php echo $this->item->image_caption; ?></b></center>
	  <?php endif; ?>

	  <?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
	  <!-- Image credits -->
	  <a class="itemImageCredits"><?php echo $this->item->image_credits; ?>
	  <?php endif; ?>



Sponsor our Newsletter | Privacy Policy | Terms of Service