All posts from all categories
-
Hi guys,
Appreciate for reading this.We all know that when we click on a category the page lists all posts from that category you’ve clicked. Okay.
Turns out that I need something to show all posts from all categories.
Is there anyway to do that WITHOUT creating a master category and giving it to all posts in the blog?
Thanks in advance,
Henry.
-
Hi Henry,
I need something to show all posts from all categories
That’s what a blog does?
It lists all your posts from all your categories.
Ryan
But it must be a specific page and show EVERYTHING, since the beginning.
I think it’s more likely to a page template.Thanks.
Yup, the blog can do that.
How can I set the sorting method to alphabetically in that case?
Really appreciate your help. I’ll try that.
And this is where we hit my limits!!
Unfortunately I wouldn’t know how to sort it alphabetically or if this is even possible. Hopefully someone else will be able to assist you with this part.
I think it is possible. Reading the documentation I’ve found a query to sort posts but appears it isn’t working or I must be doing something wrong.
I edited category.php and post-loop.php with this:
$wp_query->set( 'orderby', 'title' ); $wp_query->set( 'order', 'ASC' )
Thanks in advance.
why not use get_recent_posts?
check link and examples:
http://codex.wordpress.org/Function_Reference/wp_get_recent_postsI’m using a custom template on posts.
I’m getting the post custom field and not an excerpt, for example.I need a page to list these posts in that template (I could duplicate it if it’s necessary) and show up to the user in alphabetical order.
Can I use a page template for that?
Thxx
Using get_recent_posts it will lists all posts?
Can I use sort by title?u mean custom post types? or custom page style?
as asmi suggested check ‘pre_get_posts’.
dump this code in your functions.php file to list all posts everywhere in asc order:function asc_query_order( $query ) { $query->set( 'orderby', 'title' ); $query->set( 'order', 'ASC' ); } add_action( 'pre_get_posts', 'asc_query_order' );
you can put an if statement right at the beginning of the function to check for categories or post types etc as need be…
Hi guys!
My needs was to use a custom field to show in that page. I’ve solved my purpose using get_recent_posts. See the code below:
<?php $args = array( 'numberposts' => '5', 'orderby' => 'post_date', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-aside', 'operator' => 'NOT IN' ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-image', 'operator' => 'NOT IN' ) ) ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<li class="clearp" style="list-style: none; margin: 0;"><strong><a>' . $recent["post_title"].'</a></strong> '; echo do_shortcode(get_post_meta($recent["ID"], 'Player de aúdio', true)).'<a>Veja a letra</a>'; } ?>
Thanks for everyone!
Gratefully,
Henry.
- The topic ‘All posts from all categories’ is closed to new replies.