Show author in random posts
-
Hello everyone!
In the index.php page of my site I added this code to display random articles.
<?php $args = array( 'numberposts' => 3, 'orderby' => 'rand' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?>
The articles are displayed properly in the titles and contents. The problem is that when I try to enter the author, WP puts all the last author inserted, without finding the author of Random.
The code that I put is this:
<?php the_author(); ?> <h2>" rel="bookmark" title="Read more on <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
Someone can help me? : (
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show author in random posts’ is closed to new replies.