Custom Field on Post – Pull Post Title and URL
-
Hello, I am making use of the Custom Field for my posts.
In my posts, I have a 2 custom fields named “featured blogs”. The value for these custom fields is the URL of the blog I choose.
Now on my Post page, I have entered in the php code below.
<?php
$custom_fields = get_post_custom($post_id); //Current post id
$my_custom_field = $custom_fields[‘Featured-Blog’]; //key name
foreach ( $my_custom_field as $key => $url )
echo $key =”Title“;
?>My problem is that it puts out the word Title instead of the blog posts title while I view the page. I have tried a few different things based off of other people who have tried something like this but I just cant get seem to pin point it. Any help would be greatly appreciated. thanks
I have attached a screenshot below of what it looks like on the actual page.
- The topic ‘Custom Field on Post – Pull Post Title and URL’ is closed to new replies.