• 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

Adding a wrap div inside entry-content div

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 › Adding a wrap div inside entry-content div

This topic is: resolved

Tagged: functions.php, structural wraps

  • This topic has 8 replies, 3 voices, and was last updated 8 years ago by Brad West.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • January 23, 2015 at 1:12 am #138375
    Brad West
    Member

    I'd like to add a <div class="wrap"> inside <div class="entry-content">.

    It made sense to me the following would work, but it didn't.

    `
    add_action( 'genesis_before', 'entry_content_wrap_open' );
    function entry_content_wrap_open() {
    echo '<div class="wrap">';
    }

    add_action( 'genesis_before', 'entry_content_wrap_close' );
    function entry_content_wrap_close() {
    echo '</div>';
    }
    `

    Any ideas how to get the following?

    `
    <div class="entry-content">
    <div class="wrap">
    ...
    </div>
    </div>
    `

    January 23, 2015 at 1:55 am #138378
    Genesis Developer
    Member

    Try this method http://my.studiopress.com/snippets/structural-wraps/


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    January 23, 2015 at 2:01 am #138379
    Brad West
    Member

    I tried that, but it's not adding them where I want them. I need the wrap inside the entry-content div.

    January 23, 2015 at 2:08 am #138380
    Genesis Developer
    Member

    Ok. Then use genesis_before_content and genesis_after_content hook


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    January 23, 2015 at 2:18 am #138385
    Brad West
    Member

    That adds it after the content-sidebar-wrap like this:

    `
    <div class="content-sidebar-wrap">
    <div class="wrap">
    <main class="content">
    <article class="entry">
    <header class="entry-header"></header>
    <div class="entry-content">
    ...
    </div>
    <footer class="entry-footer"></footer>
    </article>
    </main>
    </div>
    </div>
    `

    What I'm looking for is this:

    `
    <div class="content-sidebar-wrap">
    <main class="content">
    <article class="entry">
    <header class="entry-header"></header>
    <div class="entry-content">
    <div class="wrap">
    ...
    </div>
    </div>
    <footer class="entry-footer"></footer>
    </article>
    </main>
    </div>
    `

    January 23, 2015 at 2:30 am #138386
    ᴅᴀᴠɪᴅ
    Member

    The answer is this

    //* Add Wraps to Entry Content
    add_action( 'genesis_entry_content', 'entry_content_wrap_open', 1 );
    function entry_content_wrap_open() {
        echo '<div class="wrap">';
    }
    
    add_action( 'genesis_entry_content', 'entry_content_wrap_close', 25 );
    function entry_content_wrap_close() {
        echo '</div>';
    }

    I love helping creative entrepreneurs build epic things with WP & Genesis.

    Follow on Twitter

    January 23, 2015 at 2:35 am #138387
    Brad West
    Member

    That worked. Thanks so much David.

    If I could push my luck, is there any documentation on when and how to use the priority settings? I understand how this works now that I see it, but I wouldn't have thought of it myself.

    January 23, 2015 at 2:43 am #138389
    ᴅᴀᴠɪᴅ
    Member

    Apart from looking through the Genesis files to see where things currently are located and on what priority, I just remember where most are just as I've done it so many times.

    Basic rule is obviously that the lower the number the higher priority. Priority is just the order in which they come first.

    But it's all temporary in a way. The priority '25' in the code solves your problem, but if you started to add a lot of things into that same hook you would need to move that number to allow room.

    Usually I stay away from priority '1' as you never know when you're going to add something extra on so its always nice to have the room. But in the case of adding a wrap then really you always want that as the first things so everything can be contained inside it.

    The other basic rule is that if there is no number, then it is the same as having a priority of 10.


    I love helping creative entrepreneurs build epic things with WP & Genesis.

    Follow on Twitter

    January 23, 2015 at 2:46 am #138392
    Brad West
    Member

    Cheers David. I appreciate the help.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Adding a wrap div inside entry-content div’ 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