How can you change the order of your posts?

What are ways to filter the front page posts by category in wordpress?

  • Hello, Basically I want to have a featured posts type of thing on the front page and would like to restrict those posts to a certain category, I´m not sure how to accomplish this though I'm using a yootheme  premium template and I think it does the query  with the following code <?php get_posts('orderby=menu_order&order=ASC'); ?> However, I´m not sure how to change that so it only shows posts from category 3

  • Answer:

    There are a couple ways to achieve this. If you aren't scared of code you could edit your theme code - to adjust the home page "loop" (the code that generates the list of posts) and tell it to only display a certain category. There's a thread with more info here: http://wordpress.org/support/topic/display-only-posts-from-one-category-on-homepage Another way, to avoid code, would be to use a plugin such as Ultimate Category Excluder, to exclude unwanted categories from your homepage.

Lucy Beer at Quora Visit the source

Was this solution helpful to you?

Other answers

You may also find support for this in your theme. Depending on who built it, some themes have a homepage structure for a featured content area built it. For instance, take a look at StudioPress themes - many which include this feature (and no, I don't work for them)

Dawud Miracle

Here's your solution for a front page which shows blog posts - Install the https://wordpress.org/plugins/my-custom-functions/ plugin. Go to Appearance » Custom Functions in the admin dashboard. Copy the code from my gist here (https://gist.github.com/jiteshp/90759837e9ff3c5479d3) and paste it in the editor. Click on the 'Update Custom Functions' button. You are done. If you are using a static page as a front page, I will need to take a look at your theme's code to tell you more. Let me know if you face any issues. I'll be happy to help.

Jitesh Patil

A great way to learn how to do this is to hack apart an existing theme. There is also a great information page on http://codex.wordpress.org that talked about the query_post() function which is what I use when I need to alter the default parameters of the loop. http://codex.wordpress.org/Function_Reference/query_posts

Steve Mynett

Another good 'free theme' to check put is the Arras Theme. It has three different configurable sections to show content in the 'blog' roll section of the theme, including by category, page, page exclusion, ect. Has a pretty cool 'marquee/slideshow' bulit into the top section that you can turn on and off.

Drew Coalson

I use query_post() and then add cat=2, so query_post('?cat=2') would be the way to go and you can easily get the category ID when you click on your categories section of your Wordpress admin.

Bruce Chamoff

You can modify that code to: <?php get_posts('orderby=menu_order&order=ASC&cat=CAT_ID'); ?> where CAT_ID is the category id. like: <?php get_posts('orderby=menu_order&order=ASC&cat=2'); ?>

Charles Coxhead

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.