Latest Post

Current user post data fetch in wordpress

Current user post data fetch in wordpress

Current user post data fetch in wordpress


This code for you are use for login user all post get in your page. this code working. you can try this code.

<?php
$count=1;
$current_author = get_query_var('author');
$author_posts=  get_posts( 'author='.get_current_user_id().'&posts_per_page=-1' );
echo "<pre>";
print_r ($author_posts);
echo "</pre>";
echo $author_post['post_author'];
if($author_posts){
foreach ($author_posts as $author_post)  {
?>
<tr>
<td><?=$count?></td>
<td><?=the_post_thumbnail(get_the_ID())?></td>
<td><?php echo '<a href="'.get_permalink($author_post->ID).'">'.$author_post->post_title.'</a>';?></td>
<td>100</td>
<td>100</td>
<td class="profile-view-btn"><?php echo '<a href="'.get_permalink($author_post->ID).'">'?>View<?'</a>';?></td>
</tr>
<?php
$count++;
}

}?>

No comments