php - Show posts by user -
so, here php show posts wordpress:
<div class="rfp_hide" id="rhm_profile_item"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'product', 'paged' => $paged, 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'desc' ); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $product, $post, $paged; ?> <div class="rhm_post_container"> posts go here </div> <?php endwhile; ?> <?php wp_reset_query(); ?> </div>
it shows posts regardless of posted.
each post has href following:
<a class="royal_author_link" href="<?php echo $userpro->permalink( $post->post_author ); ?>">
on post author page, permalink has following structure :
example.com/profile/someone.
now, how can modify when in specific user page, shows posts user only?
did use custom plugin create profile page? in case have access user id related page, can extend query argument attribute "author", so:
$args = array( 'author' => $youruserid 'post_type' => 'product', 'paged' => $paged, 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'desc' );
Comments
Post a Comment