• 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 div within structural wrap

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 div within structural wrap

This topic is: not resolved

Tagged: Atmosphere Pro

  • This topic has 1 reply, 2 voices, and was last updated 3 years, 8 months ago by Victor Font.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 27, 2019 at 10:30 am #491362
    julian_s
    Participant

    Hi I have the following html code for my header:

    <header class="site-header" itemscope="" itemtype="https://schema.org/WPHeader">
       <div class="wrap">
          <div class="title-area">
             <p class="site-title" itemprop="headline"><a href="https://csca.m2pvqav3-liquidwebsites.com/">CSCA</a></p>
             <p class="site-description" itemprop="description">Canadian Special Crops Association</p>
          </div>
          <button class="menu-toggle ionicons-before ion-ios-drag" aria-expanded="false" aria-pressed="false" id="genesis-mobile-nav-primary">Menu</button>
          <nav class="nav-primary genesis-responsive-menu" aria-label="Main" itemscope="" itemtype="https://schema.org/SiteNavigationElement" id="genesis-nav-primary" style="">
             <div class="wrap">
                <ul id="menu-menu1" class="menu genesis-nav-menu menu-primary js-superfish sf-js-enabled sf-arrows" style="touch-action: pan-y;">
                  "---Menu <li>s are here---"
                </ul>
             </div>
          </nav>
       </div>
       <div>Test</div>
    </header>

    I added the Test div just below the header(see above) using this code:

    remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
    add_action( 'genesis_header', 'sm_genesis_header_markup_close', 15 );
    function sm_genesis_header_markup_close() {
    	genesis_structural_wrap( 'header', 'close' );
    	genesis_markup( array(
    		'html5' => '<div>Test</div></header>',
    		'xhtml' => '</div>',
    	) );
    }

    Is there anyway to move the div into the wrap as follows:

    </nav>
     <div>Test</div>
       </div>
    </header>

    Thanks, Julian

    https://csca.m2pvqav3-liquidwebsites.com/
    May 28, 2019 at 6:48 am #491374
    Victor Font
    Moderator

    Try this:

    add_filter( 'genesis_structural_wrap-header', 'add_div_to_structural_wrap', 10, 2);
    function add_div_to_structural_wrap( $output, $original_output ) {
        
        if ( 'close' == $original_output )
        	$output .= '<div>Test</div></header>';
        
        return $output;
    }

    This article explains why this works: https://victorfont.com/understanding-genesis-dynamic-apply_filters-part-1/


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

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