I'm trying to get the below 3 columns for all posts that are in my database
- user_name
- post_title
- pods_field_blog_category
user_name and post_title is stored in wp_posts
table pods_field_blog_category is stored in wp_postmeta
table.
below code displays, user_id and post_title , but I'm not sure how to get the meta_value and display it:
<?php
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'custom_post'
)
);
if ($posts):
?>
<ul>
<?php
foreach ($posts as $post):
setup_postdata($post);
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
//what should be the code to display the meta value pods_field_blog_category
</li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); ?>
<?php endif; ?>