• 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

Add static text before grid loop on home 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 › Add static text before grid loop on home page

This topic is: not resolved

Tagged: css, grid loop, home page, posts page, static text

  • This topic has 4 replies, 3 voices, and was last updated 10 years, 1 month ago by maui.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • December 29, 2012 at 4:03 pm #8216
    CaveCanem
    Member

    I'm using a three-column Mocha theme. The home page uses a grid loop of the top five recent posts in the center column. I want to include some static "Welcome" text just before the grid loop in this column (but not in a sticky post). If I add the text before the opening "<?php" in the home.php file, the text gets added before the header instead of at the top of the center column. If I add it anywhere after the opening "<?php", I get a parsing error.

    Where can I add text so that it appears at the top of the column?

    Thanks for any help.

    December 29, 2012 at 4:42 pm #8223
    Chris Cree
    Participant

    You can add something like the following to your home.php file:

    add_action( 'genesis_before_content', 'child_home_welcome' );
    function child_home_welcome() {
    	echo '<div class="home-welcome">'; 
    	echo '<p>YOUR WELCOME MESSAGE GOES HERE</p>';
    	echo '</div><!-- end .home-welcome -->';
    }

    Then you will want to add a little CSS to your style sheet for the .home-welcome class to make it look the way you want.

    December 29, 2012 at 7:34 pm #8262
    CaveCanem
    Member

    Excellent! That did exactly what I needed. One last question: I want to style this text to match the center column in background, font, padding, etc. Where can I find that CSS in my style sheet so that I can reference the values? What is that class called?

    Thanks again!

    December 29, 2012 at 9:34 pm #8287
    CaveCanem
    Member

    Never mind that question, I found the CSS for the content column. It seems that I've got to learn my way around CSS a little better, though. Since Mocha is a responsive theme, I've got to style my welcome text "box" to match the changing styles of the content column for different screen widths. I think that I understand how that works, but I'm not sure yet.

    Also, the primary (right) sidebar seems to be anchored to the content column such that the welcome text box "pushes" the primary sidebar down along with the content column. I'm guessing I'd have to modify the primary sidebar CSSĀ  to get it to stay anchored to its original position, but I'm not sure how. The secondary (left) sidebar remains unaffected.

    Is it possible to incorporate the welcome text into the central content column before the grid loop begins (instead of above the content column in its own separate "box")? Or is the content column restricted to only grid loop content?

    Hope that this makes sense. Thanks again.

    December 30, 2012 at 6:49 am #8334
    maui
    Participant

    How can I use this code snippet if I do not have a home.php. Include in functions.php?

    Thanks
    Maui

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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