Archived topic
Mobile Header
29 replies · Started by Janette on February 24, 2017
I installed a test version of the website just so I cam modify the template without upsetting the live website. I am going to delete out of the child style sheet the css that handles the header elements and start fresh.
-Janette
Using CSS to do something like this isn't best practice and will cause issues on mobile without a doubt.
It's better to actually move the navigation below the page header element, so no CSS should be necessary.
To do that, you would use this PHP:
add_action( 'after_setup_theme','janette_move_navigation' );
function janette_move_navigation() {
remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
add_action( 'generate_after_header', 'generate_add_navigation_after_header', 15 );
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know if this helps or not :)
I read the link saying to upload through ftp the php but where do I upload the php code? I tried placing it in the GP Hooks area but that didn't work.
Using this plugin is probably the best method: https://docs.generatepress.com/article/adding-php/#code-snippets
That was cool but I received an error: Parse error: syntax error, unexpected T_FUNCTION in /home/nbocel5/public_html/wp-template/wp-content/plugins/menu-mover/menu-mover.php on line 13
What's menu mover? Did you use the Code Snippets plugin to add your PHP?
If you created your own plugin, you need to make sure you have <?php at the very top of the document above the code I provided.
It's a much better idea to use the Code Snippets plugin if you're not comfortable with PHP.
I used the plugin you recommended and created a plugin. When I added the code and hit save it gave me a fatal error. Fortunately I was able to back button, deleted the code and the site was okay again. I can try the code snippets plugin...
I will try anything to figure this out! :D
I have gotten nowhere. My menu is still stuck at top my page and the code you offered gives my website fatal errors no matter where or how I apply it... I don't know what to do. I wish it would go back to where it was for all that time. My client is very unhappy. What can i do?
Thank you,
-Janette
Did you use the Code Snippets plugin? I tried that code myself and it did exactly what it's supposed to do.
I think I followed your directions and the navigation bar is still stuck on top.
-Janette
Can I hire you to do it? It looks the same every time...
-Janette
Can you email me temporary admin login details? https://generatepress.com/contact/
In your Code Snippet, make sure you've actually activated the code. There should be an "Activate" option.
OMG! That was the issue. I had to activate!!!!
-Janette
Thank you, thank you, thank you!
You're welcome :)