I need a page to display all posts (in Foods custom post type) that have comments by the logged in user.
The list just needs to show the title with link to the title.
Is this possible?
What I’ve tried so far:
<?php if (is_user_logged_in() ) : ?>
<?php
if ( is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$args=array(
'post_type' => 'foods',
'posts_per_page' => 5,
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'Your Comments';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
}
?>
<?php endif; ?>
But of course I haven’t used $current_user->ID yet. I’m not sure yet of how to use it here.