- This topic is empty.
-
AuthorPosts
-
March 1, 2010 at 10:07 pm #28225
realph
ParticipantHey there,
I’m not too familiar with PHP and the Custom Fields in WordPress but I wanted to give something a go.
I write a few articles on my site and sometimes use other sites as a source for stories, I always link back to them (as you do) at the bottom of the article (below).
[attachment=2]source_bottom.jpg[/attachment]
What I’d love to do is add a custom field called "source" and throw the source link in the value (below).[attachment=1]customfield.jpg[/attachment]
Doing this I’d like it to create a button at the top of the article like this (below).[attachment=0]source-top.jpg[/attachment]
With it linking to the article I threw in the Custom Field value earlier.Now I’ve managed to make this work to an extent, check it out here: http://bitthirsty.com/battlefield-bad-c … wwii-level
The problem is that it appears on every article, even the ones that don’t have a source attached to it. I’d like it to only appear on the articles where I’ve set a source in the Custom Field, could anyone help me solve this.
This is the PHP I’m using for the button, like I said I don’t know much about PHP so sorry if it makes no sense whatsoever.
Code:TheDoc
MemberFrom the Snippets section:
Code:ID, ‘snippet-reference-URL’, true);if ($url) {
echo “Reference URL“;
}
?>March 1, 2010 at 10:44 pm #71836realph
Participant"TheDoc" wrote:From the Snippets section:Code:ID, ‘snippet-reference-URL’, true);if ($url) {
echo “Reference URL“;
}
?>Thanks a bunch mate. Do you know why the p tag isn’t closed though?
March 2, 2010 at 1:26 am #71841TheDoc
MemberQuote:Thanks a bunch mate. Do you know why the p tag isn’t closed though?Oops! I’ll let Chris know!
AuthorPostsViewing 4 posts - 1 through 4 (of 4 total)- The forum ‘Back End’ is closed to new topics and replies.