Author page displays all the posts (filter doesn't work)
-
Hi,
I create a author.php template, which displays the related publications by category.
The matter is that for some authors, the page displays ALL the posts of the blog. Of course they haven’t published all. And I really can’t succeed to apply the right filter.
Here is my code :
<ul> <?php global $post; $cat_args = array( 'orderby' => 'name', 'order' => 'ASC', 'child_of' => 0 ); $categories = get_categories($cat_args); foreach($categories as $category) { $post_args = array( 'category' => $category->term_id, 'type' => 'post', 'suppress_filters' => false, 'orderby' => 'menu_order', 'order' => 'ASC' ); $posts = get_posts($post_args); echo '<li><h2>' . $category->name.' <img id="plus" src="'.get_bloginfo('template_directory').'/images/plus.png" alt=""/></h2>'; echo '<ul style="display:none;">'; foreach($posts as $post) { setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <div class="background-bar"></div> <?php } echo '</ul>'; echo '</li>'; } ?> </ul>
You can see and example here : https://alchemypolymers.com/author/ddingler/
All the posts are displayed, when this author only published 5.
Thanks for your help
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Author page displays all the posts (filter doesn't work)’ is closed to new replies.