- This topic has 6 replies, 2 voices, and was last updated 4 years, 6 months ago by
David.
-
AuthorPosts
-
December 2, 2018 at 8:24 pm #746407
Chux
Hi,
I just pasted in this snippet as suggested: https://docs.generatepress.com/article/add-site-title-to-navigation/
Thinking I was being careful, I just saved (not save and activate), and site is broken.
is this code really safe (even in recent versions of GeneratePress)?
Why would just saving the snippet break a site?
December 2, 2018 at 8:40 pm #746409Chux
OK, I have recovered from it. The problem is coming from the code-snippets plugin. The site doesn’t break, but becomes inaccessible from the particular browser session from which the snippet was saved.
So, it appears this is a problem with the save function. I have tried it several times and can confirm it’s the culprit.
December 2, 2018 at 8:52 pm #746410Chux
On another note, I have gotten the site title as header working (needed font colour changes), how do I display the tagline below it ?
December 3, 2018 at 6:25 am #746662David
StaffCustomer SupportHi there,
worth reporting that issue to the Code Snippets author or try on a different browser to see if it replicates.
Try this snippet, same as the one you used, just adds the description to the output:
add_action( 'after_setup_theme', 'tu_navigation_as_header' ); function tu_navigation_as_header() { remove_action( 'generate_header', 'generate_construct_header' ); add_action( 'generate_inside_navigation', 'tu_site_title_navigation' ); } function tu_site_title_navigation() { ?> <div class="site-branding"> <p class="main-title" itemprop="headline"> <a href="<?php echo site_url(); ?>" rel="home"> <?php bloginfo( 'name' ); ?> </a> </p> <p class="site-description"> <?php bloginfo( 'description' ); ?> </p> </div> <?php }
December 3, 2018 at 12:32 pm #747101Chux
Thanks a million for the response. I tried the code and it works. These snippets are helping me understand the structure of the system.
Is there an API documentation somewhere?
On another note, the tagline definitely needs styling, and I am unable to figure out how to target it … Would be ideal to line it up exactly flush beneath the title
.. But currently it overshoots the title to the left and there is a big awkward vertical space between them that carries through to the navigation
Currently, I am using the prescribed CSS:
.main-navigation .site-branding { float: left; } .main-navigation .site-branding a { line-height: 60px; font-size: 20px; }
Any suggestions? Thanks again for your help.
December 3, 2018 at 1:26 pm #747126Chux
Hi,
I think I have got this sourced. First I looked closer at the css and php and was able to identify the relative classes.
Then I realised that trying combinations of line-height and font-size for the Title … as well font-size for the tagline (via the customiser) gave me what I needed …
So, I am marking this as closed.
Thanks again for your support. I am beginning to understand the huge flexibility of generatepress .. comes with a learning curve, but I think it’s worth it.
December 3, 2018 at 4:50 pm #747245David
StaffCustomer SupportAwesome – glad you got it resolved.
For more understanding of the PHP and WordPress then you want the codex. It gets pretty deep real fast, but to start you might want to look for thebloginfo( )
function. -
AuthorPosts
- You must be logged in to reply to this topic.