Is that possible to link FCG Image to my preferred URL?
Tuesday, June 28th, 2011 Blog by ASROk, so what if you dont want to make all the “feature” posts to have a ‘special’ URL? What if you only want certain posts to have a ‘special’ URL? (or if you forget to specify a custom link)
Well you replace this code in \plugins\featured-content-gallery\gallery.php:
- Code:
<a href="<?php the_permalink() ?>" title="Read More"></a>
With…
- Code:
<a href="<?php
$link = get_post_meta($post->ID, "link", $single = true);
if ( $link ) { echo $link; }
else { the_permalink(); } ?>" title="Read More"></a>
To specify the link (URL) – add the custom field link with the full URL to the website.
Please note: You will need to do this in two places. The first is located at line 44 and the second one is around line 69.
What the code asks is:
Get Link > If link is found, post link > If NOT found, post link to post.
