How to draw a conclusion of posts in the profile
-
I added the following code in your theme function:
function get_related_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) ); foreach ( $authors_posts as $authors_post ) { $output .= '<l i>< a>ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</ a></l i>'; } return $output; }
On page user-profile.php, I put the following code:
<?php echo get_related_author_posts(); ?>
It shows 5 posts, but I want to show only the for profile author of this posts. Now it shows all the user profiles.Each author should have a list of posts in the profile. Tell me how to do it.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.