get_post_custom_values
-
I have a post containing custom field “Related news”, which has the ID of a related post, like “Related news”=”1234”. Each post has multiple values of this field. I want to use that value to retrieve the title of the related post:
<?php $news = get_post_custom_values(‘Related news’);
foreach ( $news as $key => $value ) {<?php $my_query = new WP_Query(“p=$value”);
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><b>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”>
<?php the_title(); ?></b>
<?php endwhile; ?>
}
?>Apparently there is a mistake in it, as it returns a blank page.
Where is the mistake?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘get_post_custom_values’ is closed to new replies.