Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to reorder above header in Genesis Foodie Pro
- This topic has 16 replies, 2 voices, and was last updated 7 years, 8 months ago by styleandcheer.
-
AuthorPosts
-
May 1, 2017 at 3:03 pm #205706styleandcheerMember
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.comMay 1, 2017 at 3:06 pm #205707Brad DaltonParticipantWould need to see the code however you can use this genesis hook map as a guide.
May 1, 2017 at 3:14 pm #205708styleandcheerMemberI 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 #205709Brad DaltonParticipantDid you use a code editor or the theme editor?
Paste your code into a Github gist and link to it from here.
May 1, 2017 at 3:21 pm #205710styleandcheerMemberLooks like I was using theme editor, specifically functions.php.
May 1, 2017 at 3:22 pm #205711styleandcheerMemberMay 1, 2017 at 3:23 pm #205712styleandcheerMemberHm...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 #205713Brad DaltonParticipantMay 1, 2017 at 3:40 pm #205714May 1, 2017 at 3:41 pm #205715styleandcheerMember<script src="https://gist.github.com/anonymous/823df3cfdff4c4aad6fb46ab9d778841.js"></script>
May 1, 2017 at 4:47 pm #205716Brad DaltonParticipantSo what you want to do is:
Reposition the nav menu before the before header widget?
May 1, 2017 at 4:51 pm #205717styleandcheerMemberExactly. 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 #205718Brad DaltonParticipantReposition 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.
May 1, 2017 at 4:53 pm #205719styleandcheerMemberSo 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 #205720Brad DaltonParticipantShould be ok. Make sure you use a code editor and not the theme editor.
May 1, 2017 at 4:57 pm #205722styleandcheerMemberWow! You saved the day! Thanks, Brad! I'm sure others will benefit from this info.
May 1, 2017 at 4:59 pm #205723styleandcheerMemberUsed in theme editor (under Appearance, then Edit) and it's perfect! Thanks again!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.