How can i have custom fields on the posts page in wordpress?
Posted
by Luccas
on Stack Overflow
See other posts from Stack Overflow
or by Luccas
Published on 2010-05-07T20:48:05Z
Indexed on
2010/05/08
21:38 UTC
Read the original article
Hit count: 312
First I've created a home.php page to replace index.php and can add some custom fields on this new one and to have in it lastest 3 posts.
On home.php page I put:
<?php echo get_post_meta($post->ID, 'test', true); ?>"/>
but it doesn't works cause it tries get the post id and not the id of the page. If i put 18 (id of the page) directly it works, but i want it dinamicaly:
<?php echo get_post_meta(18, 'test', true); ?>"/>
And this condition is not satisfied for test:
if($post->post_type == 'page'){
echo 'This item is a page and the ID is: '.$post->ID;
}
© Stack Overflow or respective owner