php - Displaying User meta in wordpress -


i want display posts of user using following meta function:

<?php   $user_id = get_current_user_id();  $key = '';  $single = true;  $user_list = get_user_meta( $user_id, $key, $single );   echo '<p>the '. $key . ' value user id ' . $user_id . ' is: ' . $user_list . '</p>';  ?> 

it works fine, when $key 1 item. want use code run same query multiple keys (as key post id) can use display posts user follows:

<?php $args = array(           'post_type' => 'todo_listing',           'posts_per_page' => 4,           'order' => 'asc',           'meta_key' => '1014',           'meta_query' => array(               array(                   'key' => '$id',                   'meta_value_num' => '1',                    )               )           );   $loop = new wp_query( $args );   ?>        <?php  while ( $loop->have_posts() ) : $loop->the_post();  ?>  <?php echo get_the_id();?> <?php the_title(); ?>    <?php endwhile; ?>   

how can modify achieve this?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -