• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Unable to Specify Categories on a Blog Page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Unable to Specify Categories on a Blog Page

This topic is: not resolved

Tagged: blog page, blog template, posts page, query_args

  • This topic has 16 replies, 3 voices, and was last updated 2 years, 10 months ago by fattony69.
Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • March 12, 2020 at 8:28 am #497295
    fattony69
    Participant

    Hello, I am currently building out a family member's site. I am currently stuck because I am trying to limit the type of posts to be on the blog page,. No matter what I do, it doesn't allow me to sort out the categories I don't want to see. Would appreciate any help. Currently have a custom field of querty_args setup with the following:

    cat=2390, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2419, 2405, 2416, 2417, 2423, 2406, 2407, 2418, 2408, 2409, 2411, 2412;category__not_in=-2, -2213,-2216,-2215,-2236,-2201,-2203,-2207,-2204,-2214,-2206,-2210,-2202,-2205,-2212,-2209,-2217,-2211,-2208

    https://kneblesauto.com/blog/
    March 12, 2020 at 8:55 am #497296
    Brad Dalton
    Participant

    I tested this again and it works.

    Try removing the minus sign - before each category id when using category__not_in


    Get Help – Book Consultation.

    March 12, 2020 at 10:18 am #497297
    fattony69
    Participant

    @braddalton. Thank you for responding. That is the tutorial I used, but unfortunately it still doesn't work. This is what I am using now after updating.

    cat=2390, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2419, 2405, 2416, 2417, 2423, 2406, 2407, 2418, 2408, 2409, 2411, 2412;category__not_in=2, 2213,2216,2215,2236,2201,2203,2207,2204,2214,2206,2210,2202,2205,2212,2209,2217,2211,2208

    March 12, 2020 at 11:04 am #497299
    Anita
    Keymaster

    @fattony69 those look like the Page ID numbers and not the Category ID numbers.


    Love coffee, chocolate and my Bella!

    March 12, 2020 at 4:50 pm #497302
    fattony69
    Participant

    @anita I am under the impression it isn't. I am grabbing the ID's from the category edit links:

    https://kneblesauto.com/wp-admin/term.php?taxonomy=category&tag_ID=2390&post_type=post&wp_http_referer=%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dcategory

    March 12, 2020 at 8:27 pm #497304
    Anita
    Keymaster

    @fattony69 okay. The id numbers are large. I normally see them as lower numbers.

    From this StudioPress tutorial:

    To exclude a specific category, add a minus symbol (in other words, a dash) in front of the category ID parameter in the value field as described below.

    * In the Name field, enter or select query_args.
    * In the Value field, enter cat=all. All posts from all categories will be displayed on the page.
    * Click Add Custom Field to preserve your settings.

    And normally, you do not include the spaces after the comma (i.e., 1,2,3)

    You also have a semicolon in your code which should probably be a comma.

    ;category__not_in=2

    Maybe take all of that out of there completely and only include the items you do not want to have displayed.


    Love coffee, chocolate and my Bella!

    March 12, 2020 at 8:50 pm #497305
    Brad Dalton
    Participant

    The semicolon is used to separate each argument.

    There's no need to use cat and category__not_in

    You either include the categories you want to display or exclude the ones you don't.

    Also note, are you using the id for parent categories or child categories?


    Get Help – Book Consultation.

    March 12, 2020 at 8:52 pm #497306
    Anita
    Keymaster

    Thanks @braddalton.


    Love coffee, chocolate and my Bella!

    March 12, 2020 at 9:35 pm #497307
    fattony69
    Participant

    @anita and @braddalton I appreciate your help very much. I took what you both said and replaced it with the following, but for some reason, nothing changed.

    cat=-2,-2213,-2216,-2215,-2236,-2201,-2203,-2207,-2204,-2214,-2206,-2210,-2202,-2205,-2212,-2209,-2217,-2211,-2208

    Also, to answer your question, it is both the parent and child categories.

    March 12, 2020 at 9:44 pm #497308
    Brad Dalton
    Participant

    Are they the parent id's or child category id's?

    Would need to see the entire custom field value field which includes your other arguments.

    Please take a screenshot of the custom field which includes the key and value fields.


    Get Help – Book Consultation.

    March 12, 2020 at 9:49 pm #497309
    fattony69
    Participant

    @brad "2" is the parent category id and the subsequent numbers are the child category id's. Here are the custom field key and values.

    March 12, 2020 at 9:58 pm #497311
    Brad Dalton
    Participant

    See here https://developer.wordpress.org/reference/classes/wp_query/#category-parameters

    Try category__not_in with the parent category id's only.


    Get Help – Book Consultation.

    March 12, 2020 at 10:05 pm #497312
    fattony69
    Participant

    @brad I tried that as well and unfortunately did not work.

    March 12, 2020 at 10:32 pm #497313
    Brad Dalton
    Participant

    The field name should be query_args like this


    Get Help – Book Consultation.

    March 12, 2020 at 10:34 pm #497314
    fattony69
    Participant

    @braddalton Ah. I have fixed it to what you showed and unfortunately still doesn't change.

    March 12, 2020 at 10:51 pm #497315
    Brad Dalton
    Participant

    And you added the parent category id's or child id's?

    You set the Settings > Reading > posts page to the page using the custom fields?

    Based on my testing it works.


    Get Help – Book Consultation.

    March 12, 2020 at 11:02 pm #497316
    fattony69
    Participant

    @braddalton Solely the parent category id and yes I chose the correct page.

  • Author
    Posts
Viewing 17 posts - 1 through 17 (of 17 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble