- This topic has 9 replies, 5 voices, and was last updated 7 years, 11 months ago by
David.
-
AuthorPosts
-
August 13, 2017 at 11:23 am #365286
Gary
How can I get the site title to appear in the primary navigation bar (at the left) on every page but the home page?
Thanks!
GaryAugust 13, 2017 at 12:36 pm #365323Jamal
You can try this php
//Site title inside navigation add_action( 'generate_inside_navigation','site_title_inside_navigation' ); function site_title_inside_navigation() { if ( !is_front_page() ){?> <div class="inside-navigation-content"> <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a> </div> <?php } }Then add this css
.inside-navigation-content { display: inline-block; float: left; padding-top: 10px; }Adding PHP: https://docs.generatepress.com/article/adding-php/
Adding CSS: https://docs.generatepress.com/article/adding-css/August 13, 2017 at 12:37 pm #365326Leo
StaffCustomer SupportThanks Jamal!
August 13, 2017 at 12:44 pm #365332Jamal
Happy to help out Leo. I had this ready in my GeneratePress gist so i copy pasted it here.
August 13, 2017 at 5:12 pm #365436Gary
I copied both pieces of code provided into ‘Code Snippets’ and ‘Simple CSS’.
I do not see the site title in the menu.
On pages other than the front page, the last menu item wraps onto the next line (which I do not want to happen).I have removed it from my site for now as its not working.
Was I supposed to modify any of the code to meet my specific site?
Thanks!
GaryAugust 13, 2017 at 7:38 pm #365469Leo
StaffCustomer SupportThe first block of code goes into Code Snippet and url need to be replaced with the actual site url.
The second block og code goes into Simple CSS and nothing needs to be modified there.
If this doesn’t work can you link me to the site?
Thanks!
June 22, 2018 at 3:10 pm #606410Paul
I want to add the site-description to the navigation along with the site-title too. What should this code look like in order to do that? Thanks in advance.
June 22, 2018 at 3:20 pm #606412David
StaffCustomer SupportHi Paul, something like this:
add_action( 'generate_inside_navigation','site_title_inside_navigation' ); function site_title_inside_navigation() { ?> <div class="inside-navigation-content"> <a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a> <p title="<?php bloginfo('description'); ?>"><?php bloginfo('description'); ?></a> </div> <?php }June 22, 2018 at 3:42 pm #606415Paul
Cheers, thanks David!
June 25, 2018 at 3:03 am #607874David
StaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.