This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Custom category query for Post Loop

Resolved 13 replies premiumthemetheme-vantage
11 years ago · Last reply by Andrew Misplon 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

13
  1. Izzie P. 11 years, 10 months ago

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

  2. Andrew Misplon Staff 11 years, 10 months ago

    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. CJ Cornell 11 years, 10 months ago

    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. Andrew Misplon Staff 11 years, 10 months ago

    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. CJ Cornell 11 years, 10 months ago

    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. Izzie P. 11 years, 10 months ago

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

  7. Izzie P. 11 years, 10 months ago

    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. CJ Cornell 11 years, 10 months ago

    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. Andrew Misplon Staff 11 years, 10 months ago

    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. sesaya 11 years, 3 months ago

    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. idn1221 10 years, 9 months ago

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

    • Andrew Misplon Staff 10 years, 9 months ago

      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.

Have a different question or issue?

Start New Thread