views:

9

answers:

1

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;
}
A: 

Hi Luccas,

Try:

if ($post->post_type == 'page') {
    <?php echo get_post_meta($page_id, 'test', true); ?>
}

Hope this helps :)

XaviEsteve