slightlyoff
asked on
Wordpress Custom Fields from a Post
On my website, some pages have a lower third section that I want to make editable and separate from the page itself.
I created a category called "lower-thirds" and created a new post(#38) with 2 custom fields.
Here's my code:
The custom field values are saved for post #38, but the img src tag is blank when I run this code.
The text and header is working as it is supposed to.
Any suggestions?
I created a category called "lower-thirds" and created a new post(#38) with 2 custom fields.
Here's my code:
<?php
$post_id = 38;
$queried_post = get_post($post_id);
?>
<div class="bottom_third_img">
<img src="<?php get_post_meta($post_id->ID,'bottom_third_head',true);?>" width="673" height="38">
</div>
<div class="bottom_third_txt">
<div class="bottom_third_info">
<h2><?php echo $queried_post->post_title; ?></h2>
<p><?php echo $queried_post->post_content; ?></p>
</div>
<div class="bottom_third_picture">
<img src="<?php get_post_meta($post_id->ID,'bottom_third_image',true);?>" alt="Alt Text Here..." width="161" height="100">
</div>
<div style="clear:both;"></div>
</div>
The custom field values are saved for post #38, but the img src tag is blank when I run this code.
The text and header is working as it is supposed to.
Any suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to assist. Let me know if you have any further issues.
ASKER