Introduction

Featured images use conditionals to determine if it should link or not. In most cases, a link will not be present. This is due to the video functionality – if the video element contains a link to the post, it can conflict with the inherent on-click functionality of the video to play it, resulting in unpredictable behavior.  If videos are not used, the link function can be restored to all elements through the media.php file.

This article is only for the themes tagged above. Do not perform this modification on our Dynapack (Flatpack, Retail Therapy, Department, etc) series of eCommerce themes or our single-page themes (Express or Foundation)

The Solution

You can change the function completely – this will affect all images:

This is considered a modification, and is provided as-is. We expect you understand what you are doing if applying coding changes using these or other WordPress tutorials. Make a backup of your existing file so you can replace it if something goes wrong and you need to start over. Modified files WILL probably be replaced by a theme update at some point, so keep note of your changes for future reference or see our guides below. We cannot assist you with modifying your theme or support problems you encounter as a result!

If you are modifying a theme as part of a client project, the following are really important!

How to Modify Your Theme the Right Way
How to Track Update Changes and Maintain Modifications

In a local copy of the theme, open ocmx/front-end/media.php and find lines 63-67 near the bottom:

if($hide_href == false && ( ( $get_post_video == "" && $video_embed_link == "" ) || $exclude_video == true) ) :
$img_html = "<a href="$link" class="$href_class">$post_image</a>";
else :
$img_html = $post_image;
endif;

Replace  $img_html = $post_image;  with $img_html = “<a href=”$link” class=”$href_class”>$post_image</a>”;

if($hide_href == false && ( ( $get_post_video == "" && $video_embed_link == "" ) || $exclude_video == true) ) :
$img_html = "<a href="$link" class="$href_class">$post_image</a>";
else :
$img_html = "<a href="$link" class="$href_class">$post_image</a>";
endif;

Upload the changes to wp-content/themes/yourtheme/ocmx/front-end

To remove the links from your Obox widget images, you do the opposite of the above by replacing the red line with the blue line.

Elementor