• 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

How can I add a div right before nav-primary?

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 › General Genesis Framework Discussions › How can I add a div right before nav-primary?

This topic is: not resolved

Tagged: site-header

  • This topic has 1 reply, 2 voices, and was last updated 3 years, 1 month ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 13, 2022 at 6:52 am #505936
    songdogtech
    Participant

    I need to insert a div right before the opening div of nav-primary, but the Genesis hooks don't support such fine control.

    Using genesis_before_header like this

    add_filter('genesis_before_header','my_new_div');
    function my_new_div() {
    echo '<div class="add-div-here">My New Div</div>'; 
    }

    puts the div after the opening of site-container, like this:

    <div class="site-container">
    <div class="add-div-here">My New Div</div>
    <header class="site-header"
    ...

    But this is what I need:

    <div class="site-container">
    <header class="site-header" itemscope itemtype="https://schema.org/WPHeader">
    <div class="wrap">
    <div class="title-area">
    <h1 class="site-title" itemprop="headline">
    <a href="https://example.com/">Site Title</a></h1>
    <p class="site-description" itemprop="description">Site Description</p></div>
    
    <div class="add-div-here">My New Div</div>
    
    <nav class="nav-primary" aria-label="Main" itemscope itemtype="https://schema.org/SiteNavigationElement">
    <div class="wrap">
    <ul id="menu-dropdown-main-navigation" class="menu genesis-nav-menu menu-primary">
    ....
    

    How can I do that?

    October 14, 2022 at 7:54 am #506007
    Brad Dalton
    Participant

    Try the Genesis site title hook or another site header hook https://wpsites.net/genesis-hooks/


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 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