[Resolved] Just saved (not activated) your recommended snippet and site broke

Home Forums Support [Resolved] Just saved (not activated) your recommended snippet and site broke

Home Forums Support Just saved (not activated) your recommended snippet and site broke

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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?

    #746409
    Chux

    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.

    #746410
    Chux

    On another note, I have gotten the site title as header working (needed font colour changes), how do I display the tagline below it ?

    #746662
    David
    Staff
    Customer Support

    Hi 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
    }
    #747101
    Chux

    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.

    #747126
    Chux

    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.

    #747245
    David
    Staff
    Customer Support

    Awesome – 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 the bloginfo( ) function.

    https://codex.wordpress.org

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.