-
Author
-
October 31, 2015 at 20:04 #85226alvinhyParticipant
Hello,
I have a page with the blog masonry, and would like the image to link to a custom field using Types plugin.
I tried to edit the /page-parts/page-content-masonry.php at around line 150 I added:
$link = get_post_meta($the_id, ‘wpcf-website’, true);
echo ‘<a href=”‘. $link .'” class=”element-wrap”>’
but then once I save it the image does not link to the custom field I set, instead it just refreshes the page (does nothing). Am I doing something wrong?
Thanks.
Attachments:
You must be logged in to view attached files.October 31, 2015 at 21:06 #85231sharmstrModeratorHow have you set $the_id? Echo out $link to make sure $link is what you think it is.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 1, 2015 at 08:36 #85306alvinhyParticipantHello there,
I got it to work by using:
$link = get_post_meta($post->ID, 'wpcf-website', true);
Another question is, is it possible to only show this code only for IMAGE post type formats?
COPY CODE<?php $cfsource = get_post_meta($post->ID, 'wpcf-source', true); echo '<div class="cflink"><a href="'. $link .'" target="_blank">Get it at '. $cfsource .' Today</a></div>'; ?>
November 1, 2015 at 13:02 #85320sharmstrModeratoruse this https://codex.wordpress.org/Function_Reference/get_post_format
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.