newyorkcity
Member
Posted 9 months ago #
I'm trying to get a url to display inside the "Peek" link in my RSS but its displaying at the top before its suppose to. Here is a screenshot: http://cl.ly/image/0k1o2k251q0P
Where it says "http://testinglink.com" is suppose to be in the href="..." for the Peek link at the bottom.. but its displaying in the Google RSS Reader too soon.
And here is the function in Pastebin: http://pastebin.com/1jBhNS1n
How do I fix this?
getCustomField() is not a WordPress function (plugin?). Can we have a look at that function?
newyorkcity
Member
Posted 9 months ago #
I'm not sure where to find that.. I'm using this plugin: http://wordpress.org/extend/plugins/custom-field-template/ for the custom fields on the website
newyorkcity
Member
Posted 9 months ago #
nope! dont have that in there anywhere
newyorkcity
Member
Posted 9 months ago #
should that be added or should the code be altered to do what im trying to do?
should that be added or should the code be altered to do what im trying to do?
No, the function not WordPress and not from the plugin so I think it has to be from another plugin or somewhere else in your theme.
newyorkcity
Member
Posted 9 months ago #
so something else is causing getCustomField() to echo?
Search your theme template files for "getCustomField"
newyorkcity
Member
Posted 9 months ago #
Ok, copying all the theme files to my computer from ftp so i can search them all give me a sec
newyorkcity
Member
Posted 9 months ago #
I don't see it defined anywhere, all I see is <?php getCustomField('Affiliate Link'); ?> and other types of fields for example: <?php getCustomField('Pricing'); ?> in the template files and i showed you what was in the themes functions.php file.. I also tried the custom-field-template plugin folder and nothing showed up for getCustomField. Would this mean its just echoing by default and its not defined?
In this function
http://pastebin.com/1jBhNS1n
It isn't echoing out anything, so where are you using the returned value to echo it out?
newyorkcity
Member
Posted 9 months ago #
I was told that getCustomField is echoing by default and thats why the url is appearing at the very top like what can be seen here: http://cl.ly/image/0k1o2k251q0P but im not sure how to stop it from appearing at the top and inside href="..." instead
So if you remove getCustomField('Affiliate Link') from the function, in theory the url will cease to appear at the very top.
Have you tried this?
newyorkcity
Member
Posted 9 months ago #
I havent tried it but how will it work? the 'Affiliate Link' link is where the url is entered: http://cl.ly/image/1T320Y211H46
To test what you are talking about. do I just remove getCustomField('Affiliate Link') from
$content = $content . '<a href="' . getCustomField('Affiliate Link') . '">Peek</a>';?
newyorkcity
Member
Posted 9 months ago #
that works! thank you!
I do have another quick question, if I wanted to add if{} for the pages that do not have the affiliate link, what would i wrap around $content = $content . '<a href="' . get_post_meta($post->ID, 'Affiliate Link', true) . '">Peek</a>';
Thanks again!
Try it with:
$affiliatelink = get_post_meta($post->ID, 'Affiliate Link', true);
if($affiliatelink != '') {
$content .= '<a href="' . $affiliatelink . '">Peek</a>';
}
newyorkcity
Member
Posted 9 months ago #