• 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

Generate Theme: Set Home Page to Specific Post Category

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 › Generate Theme: Set Home Page to Specific Post Category

This topic is: resolved

Tagged: generate, home, Static Page

  • This topic has 7 replies, 3 voices, and was last updated 9 years, 8 months ago by David Chu.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • July 30, 2013 at 10:11 am #53214
    skibob1027
    Member

    I'm new to Genesis, so please pardon my ignorance in how to make this work. I've tried searching the forums and reading documentation, but I'm just not "getting it".

    I'm using the generate theme, but would like to replace the rolling series of posts with static content. My thought was that I can create a single post assigned to the "Home" category that will show up in place of the running list of most recent posts in the standard theme. Additionally, I would like to use a specific widget sidebar for the home page instead of the primary widget sidebar that is used on all other pages.

    Here are the two basic questions:

    • How can I edit home.php to show a specific post or post category instead of the six most recent posts?
    • How can I set the home page to use a different widget sidebar in lieu of the primary widget sidebar?

    Thanks!

    http://www.steibelsauto.com
    July 30, 2013 at 10:59 am #53219
    David Chu
    Participant

    Hi,
    That's actually a fairly advanced question, so don't feel too bad! My answer is actually a general WordPress answer, not specifically for Genesis. What you do is "intercept" the loop slightly. You'll need to be comfortable editing code.

    First, go to Posts.... Categories. Find the Category you want (you said "Home" in your question), and hover your mouse over its link. Somewhere on your screen, a link should appear that's very long, and you'll be looking in the link for something like "tag_ID=3". You'll want to make a note of the number.

    Now comes the editing. Appearance.... Editor. Look to the right, and find "home.php". Click on that. If you're nervous, copy the code from that and save it. ๐Ÿ™‚ You'll also want to have FTP access to the site in case you make a typo that stops your site from working.

    You'll see this line in there:

    function child_grid_loop_helper() {
    

    Just below that, you can add this line, changing the "3" to the number you saved above. (make sure it's on its own line!!)

       query_posts ($query_string . '&cat=3');
    

    This preps the loop to only show that particular Category. If it all works, save your code somewhere in case you or the client inadvertently update Generate and blow away your addition.

    Good luck,
    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

    July 30, 2013 at 11:41 pm #53324
    ahufford
    Member

    This is very helpful information. I was looking to do the same thing. However, I've disabled home.php because I couldn't get the formatting to show up in my excerpts (was using the grid, now I am not). Is there a way to add this code -- query_posts ($query_string . '&cat=3'); -- to functions.php and have it just apply to the home page?

    July 31, 2013 at 7:47 am #53378
    David Chu
    Participant

    Hi,
    Ah, someone after my own heart.... doing as much as possible in functions instead of template files. ๐Ÿ˜‰

    Yes, you could do that. I would suggest going here for an example:

    http://genesissnippets.com/genesis-custom-loop/

    ... and one could use this instead of category_not_in, for instance:

    category__in
    

    And then you could is_home() or is_front_page() logic, depending on context, to have it only work on Home.

    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

    August 1, 2013 at 10:42 am #53572
    skibob1027
    Member

    David, thank you very much for your help! The solution was exactly what I was looking for. I'm still having trouble setting the home page to use a different widget sidebar in lieu of the primary widget sidebar. Do you have any thoughts as to how I can accomplish that goal?

    Thanks!

    August 1, 2013 at 11:14 am #53582
    David Chu
    Participant

    Great! You could hire me to code it. ๐Ÿ˜‰

    But I'm thinking that Genesis Simple Sidebars plugin may work for that. I have a designer partner who is Sidebar Crazy, and she uses that ad infinitum. One site we did had something like 50 different sidebars. Oy vay! ๐Ÿ™‚

    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

    August 1, 2013 at 5:57 pm #53632
    skibob1027
    Member

    David, you sir, are awesome. I think I can handle this one, but I'm bookmarking your site for complex help in future projects. I speak PHP as a "second language", so to speak, but haven't completely figured out how Genesis works within WordPress.

    August 1, 2013 at 8:35 pm #53666
    David Chu
    Participant

    Bob,
    I appreciate the positive thoughts, thanks! I'm glad that helped.

    It's true, WordPress knowledge is one thing, and Genesis is another (albeit smaller). The good news is that once you've done Genesis for awhile, WordPress development becomes easier. I see themes with 20+ template files, and most of my custom child themes have a whopping 2! ๐Ÿ˜‰

    Talk to you later,
    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Generate Theme: Set Home Page to Specific Post Category’ is closed to new 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