So, here is my php to show posts for 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 all the posts regardless of who posted.
Each post has its href as following:
<a class="royal_author_link" href="<?php echo $userpro->permalink( $post->post_author ); ?>">
On the post author page, the permalink has following structure :
example.com/profile/someone.
Now, how can I modify it so that when I am in a specific user page, it only shows the posts by that user only?
Did you use a custom plugin to create the profile page?
In case you have access to the user ID related to the page, you can extend the query argument by the attribute “author”, like so: