• 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 to reorder above header in Genesis Foodie Pro

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 › How to reorder above header in Genesis Foodie Pro

This topic is: resolved

Tagged: hooks, priority

  • This topic has 16 replies, 2 voices, and was last updated 6 years, 4 months ago by styleandcheer.
Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • May 1, 2017 at 3:03 pm #205706
    styleandcheer
    Member

    Hi there,

    I'm new to all this, but am dipping my toes into code snippets and have a question about how to re-order items above header.

    I am working in Foodie Pro theme which has a widget area above header for "featured posts" which I activated.

    I also added a code snippet in PHP to move the navigation bar above header. It worked great.

    Right now, I show "featured posts" widget, then navigation bar, then header. However, I want to show navigation bar, then "featured posts" widget, then header. I added a priority number 1 in the snippet that moved navigation up, but nothing changed. What am I missing?

    Please, help. Thanks in advance!

    http://www.styleandcheer.com
    May 1, 2017 at 3:06 pm #205707
    Brad Dalton
    Participant

    Would need to see the code however you can use this genesis hook map as a guide.


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 3:14 pm #205708
    styleandcheer
    Member

    I have seen this hook map online already, and it makes things even more confusing for me, because it looks like all I have to do is hook up the navigation bar to the very top hook called "genesis_before" and my issues would be solved, right? But when I messed with the code, my site crashed. It was backed up so I'm up and running again, but back to square one.

    Which part of the code should I provide?

    May 1, 2017 at 3:15 pm #205709
    Brad Dalton
    Participant

    Did you use a code editor or the theme editor?

    Paste your code into a Github gist and link to it from here.


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 3:21 pm #205710
    styleandcheer
    Member

    Looks like I was using theme editor, specifically functions.php.

    May 1, 2017 at 3:22 pm #205711
    styleandcheer
    Member

    May 1, 2017 at 3:23 pm #205712
    styleandcheer
    Member

    Hm...my link to Github is not showing up. I made it secret, should I have made it public?

    May 1, 2017 at 3:36 pm #205713
    Brad Dalton
    Participant

    Embed the public link without the javascript


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 3:40 pm #205714
    styleandcheer
    Member

    <https://gist.github.com/anonymous/823df3cfdff4c4aad6fb46ab9d778841&gt;

    May 1, 2017 at 3:41 pm #205715
    styleandcheer
    Member

    <script src="https://gist.github.com/anonymous/823df3cfdff4c4aad6fb46ab9d778841.js"></script>

    May 1, 2017 at 4:47 pm #205716
    Brad Dalton
    Participant

    So what you want to do is:

    Reposition the nav menu before the before header widget?


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 4:51 pm #205717
    styleandcheer
    Member

    Exactly. I want the navigation to be right at the top, above the "featured posts" widget area (which is genesis_before_header). I tried to change the snippet wording to before_before_header but it didn't have any effect. Or that's when my site crashed, can't remember now.

    May 1, 2017 at 4:51 pm #205718
    Brad Dalton
    Participant

    Reposition the nav menu using the genesis_before hook with a priority lower than 10

    remove_action( 'genesis_after_header', 'genesis_do_nav' );
    add_action( 'genesis_before', 'genesis_do_nav', 1 );
    

    There is no before_before_header hook as you can see in the hook map.


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 4:53 pm #205719
    styleandcheer
    Member

    So is this what the new code needs to look like?

    // Move primary navigation
    remove_action( 'genesis_after_header', 'genesis_do_nav' );
    add_action( 'genesis_before', 'genesis_do_nav', 1);

    May 1, 2017 at 4:56 pm #205720
    Brad Dalton
    Participant

    Should be ok. Make sure you use a code editor and not the theme editor.


    Tutorials for StudioPress Themes & WooCommerce.

    May 1, 2017 at 4:57 pm #205722
    styleandcheer
    Member

    Wow! You saved the day! Thanks, Brad! I'm sure others will benefit from this info.

    May 1, 2017 at 4:59 pm #205723
    styleandcheer
    Member

    Used in theme editor (under Appearance, then Edit) and it's perfect! Thanks again!

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