Home>Support>Custom category query for Post Loop

Custom category query for Post Loop

Hi,
I wanted to use just a single category for my post loop and I recall finding a code somewhere to put for the query but I can’t seem to remember where I found that

I wrote down :

category_name=”slug” but when I tried this, it wasn’t working.
Did I copy it down wrong?
Thanks!

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 10 years, 5 months ago Izzie P.

    Update: Nevermind, I figured it out and I feel silly (no quotes, derp)

  2. 10 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Hi Izzie

    Glad you found the solution. You can also insert:

    cat=x

    Where x is the category ID. You can get the category ID by going to Posts > Categories and finding the ID in the url. You can also pull multiple categories by comma separating ID’s.

  3. 10 years, 5 months ago CJ Cornell

    wow – an amazing kind of psychic esp…
    I was JUST struggling with this. While I easily got a caqtegory filter working on the blog posts page – I am going nuts trying to figure out how to display just one category of posts on the HOME page loop! a simple query_posts(‘category_name=featured’); does not work (in loop-home.php) since it is a clever little loop that I cannot quite follow.
    Please put me out of my misery and help me insert this query filter just for POSTS
    (essentially, on the home page loop for ‘latest blog posts’ I want only a particular category to display)\
    Thanks!

  4. 10 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Hi CJ

    Assuming you’re using a static page or Appearance > Home Page you can just insert a Post Loop (PB) widget, use the Blog template within the widget and enter into the Additional Field (last setting in the widget):

    cat=x

    Where x is the ID of the category. Head to Posts > Categories and click on your Featured category. In the url you’ll see the category ID displayed as a number.

  5. 10 years, 5 months ago CJ Cornell

    I’m not sure I quite understood. Yes, I am using static, appearance Home Page.
    The Blog Blog is the one I want filtered – but otherwise to appear like it should, with the theme. I fear that using a widget

    here’s a screenshot with an annotation to make it clearer
    http://cogswellcrowdfunding.com/wp-content/uploads/2014/04/pitchscreenshot.png

  6. 10 years, 5 months ago Izzie P.

    So you want the “recent posts” to NOT display featured?

  7. 10 years, 5 months ago Izzie P.

    I used several post loop widgets via the built-in homepage to get the effect I wanted here: http://www.infusedmusings.com/

    The page builder: http://i.imgur.com/C1QGGaz.png
    And how I set up my loops: http://i.imgur.com/MNbkkpR.png

  8. 10 years, 5 months ago CJ Cornell

    was this last comment directed towards me?

    I just simply want to FILter the ‘recent posts’ by a single category. everything else should stay the same. On any other theme this would merely be a matter of inserting a query statement, but it is not so straight forward here.

  9. 10 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Thanks Izzie.

    CJ the issue is that we’re discussing the Post Loop widget within our Vantage theme and you’re running Pitch which doesn’t have this same ability. I think we’ve chatted on email support before right? Drop me a mail if you’d like to consider moving across to Vantage and I’ll make the necessary changes on my side.

    https://siteorigin.com/theme/vantage/

    I estimate you’d need about an hour’s worth of work to do the move.

  10. 9 years, 10 months ago sesaya

    I am new to WordPress and I am currently working on 3 websites (sesaya being one of my clients), all with the Vantage Premium theme. The ways to display posts have me overwhelmed and I am hoping you can help me as reading this forum has just about driven me mad! I am becoming brain-dead learning about all of the plugins and features.
    Question 1: How do I get an image to display in a post excerpt and in a post loop carousel?
    Question 2: Sesaya would like to display different posts on different pages; categorize some posts as “Reviews” and have them placed on a “Reviews” page, etc. Is this possible, as well as including multiple categories on each post?

  11. 9 years, 4 months ago idn1221

    where do i insert “cat=x” i also want my post loop – post type: list of category to choose from. please help

    • 9 years, 4 months ago Andrew Misplon
      Hi, I Work Here

      Hi idn1221

      You can insert arguments in to the Additional field of the Post Loop widget, it’s the last field in the widget. However the latest version has a query builder so you shouldn’t need to manually build your query.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More