• 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

blog page template won't exlude categories

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 › General Discussion › blog page template won't exlude categories

This topic is: not resolved

Tagged: blog page template

  • This topic has 14 replies, 2 voices, and was last updated 10 years, 2 months ago by Brad Dalton.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • September 11, 2013 at 2:56 pm #62009
    dompalmer
    Member

    Hi,

    I've created a standard child theme for Genesis and am trying to limit the categories displayed on the blog page template to just one: 'news'. I've tried this through the theme options via the blog page template tab but the page will only display all categories whether I choose to display only one or omit the others. Is there something I'm missing with this?

    Many thanks in advance!

    http://arete.dominicpalmer.co.uk/latest-news/
    September 12, 2013 at 1:37 am #62067
    Brad Dalton
    Participant

    Try this

    https://gist.github.com/braddalton/5530851


    Tutorials for StudioPress Themes.

    September 12, 2013 at 1:04 pm #62135
    dompalmer
    Member

    Thanks for the swift response Brad. I'm afraid it didn't work however. I placed the code into the functions.php file and changed the category from '-007' to '-002' (as my blog category that I want to keep is has the ID of 2) but the page is still displaying all of them.

    Any other thoughts at all would be much appreciated

    Many thanks

    September 13, 2013 at 1:05 am #62211
    Brad Dalton
    Participant

    007 is in reference to 007 the actor and movie. Its a placeholder number.

    You will need to replace that with your i.d which is 2.

    Not 002 because i think he's been replaced!!


    Tutorials for StudioPress Themes.

    September 14, 2013 at 12:18 pm #62545
    dompalmer
    Member

    haha! Ok I now understand...

    I've added your code but am having now luck again I'm afraid - All categories are still displaying http://arete.dominicpalmer.co.uk/latest-news/

    Just to clarify. The category I want to exclusively display is '2' so I have adapted the code here

    Am I missing something??

    Many thanks again

    September 14, 2013 at 12:46 pm #62547
    Brad Dalton
    Participant

    You missed the -

    So it should be -2

    Should work now.


    Tutorials for StudioPress Themes.

    September 14, 2013 at 12:54 pm #62548
    dompalmer
    Member

    Well spotted and thanks again for your persistence... however it still hasn't done it. All categories still displaying.

    Could I have altered something else that has had a knock on effect? There's every possibility I've edited something without realising...

    Many thanks

    September 14, 2013 at 12:57 pm #62550
    Brad Dalton
    Participant

    Maybe. What have you set in the Genesis > Theme Settings > Blog Page Template?


    Tutorials for StudioPress Themes.

    September 14, 2013 at 1:10 pm #62552
    dompalmer
    Member

    The option there is set to 'news' also. It doesn't have any effect on the filter regardless of what I set it to unfortunately

    September 14, 2013 at 1:18 pm #62554
    Brad Dalton
    Participant

    It should work so there must be a problem. Try deactivating all your plugins and see what happens.

    Then you can activate them one by one to see if its a plugin conflict.


    Tutorials for StudioPress Themes.

    September 14, 2013 at 1:40 pm #62557
    dompalmer
    Member

    Still no joy 🙁 I turned them all off but the problem persisted.

    I must've messed with something here but can't think what.

    Do you think an alternative might be just to set up a new page template to only feed the one category? Seems a bit drastic but...

    September 15, 2013 at 2:28 am #62606
    Brad Dalton
    Participant

    Change the conditional tag:

    is_page('blog')
    

    To the page i.d for your blog which can can grab from the source code in the body tag section.


    Tutorials for StudioPress Themes.

    September 15, 2013 at 9:46 am #62636
    dompalmer
    Member

    Thanks Brad - I haven't tried it yet but I think you've found the issue

    I got the page working using a workaround. I selected the blog template file and added

    query_args: cat=1 into the custom fields

    this did the trick in the short term - Many thanks again for your help with this one

    September 20, 2013 at 5:06 am #63505
    Brad Dalton
    Participant

    Just tested this code and it works on the home page.

    Note: You'll need to change the conditional tag and the category i.d in the code.


    Tutorials for StudioPress Themes.

    September 26, 2013 at 12:28 pm #64319
    Brad Dalton
    Participant

    Note: Use of the is_home() conditional tag depends on your Reading Settings.

    If your Reading Settings are set to: Front page displays > Your latest posts, then the is_home() conditional tag will return true for your front page.

    If your Reading Settings are set to: Front page displays > A static page (select below) , then the is_home() conditional tag will return true for your blog page and not your Front Page.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘General Discussion’ 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