Using custom fields in the template
-
I’m attempting to use the
get_post_custom_values()
function to retrieve a custom field for a post titled “news-image”.I want to use this variable as the src attribute for an <img />
Here is my code:
<?php $imgSrc = get_post_custom_values('news-image'); ?> <img src="<?php echo $imgSrc[0]?>" />
In the HTML the src continues to be null. You can view my page at https://metroiceblog.net
What am I doing wrong?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Using custom fields in the template’ is closed to new replies.