[Resolved] Site logo and title in navigation

Home Forums Support [Resolved] Site logo and title in navigation

Home Forums Support Site logo and title in navigation

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #748139
    Kritish

    Hi,

    I am new to using generatepress, I have looked around in the document library and searched on the support forums but I am unable to find something that works for me. I have found things from here and there and used code snippets to move my header into the navigation as you can see on my website, but I am unable to add a logo next to the site title.

    I have used the following php code to get my title moved from my header into the navigation

    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>
    	</div>
        <?php
    }

    Along with this CSS

    .main-navigation .site-branding {
    	float: left;
    }
    
    .main-navigation .site-branding a {
    	line-height: 60px;
    	font-size: 20px;
    }

    I have to replicate the menu layout of another site onto my site, the colours don’t have to match, but the look does. The title/logo is on the left, the menu is on the right. I have blocked out the website name as I do not own the site.

    https://imgur.com/MSLn6ZF

    #748199
    David
    Staff
    Customer Support

    Hi there,

    if you add the Logo in Customizer > Layout > Primary Navigation Logo (Sticky + Static). Then we can provide the CSS to arrange them. Let us know where you want the logo once it has been added, i assume before the site title.

    #748210
    Kritish

    Hi David,

    Thanks for that, I have added the logo.

    #748255
    David
    Staff
    Customer Support

    Hi there,

    looking good, i can see logo, i assume its in the correct position?
    BTW the logo size is defined by the Menu Height you set in the Customizer > Layout > Primary Navigation. Let me know if you need anything else.

    #748269
    Kritish

    Hi David,

    Yes I also needed to change the styling(?) of how the menu looks to match this image

    Menu

    #748271
    Kritish

    Sorry I had the wrong link in my last post

    Menu

    #748276
    David
    Staff
    Customer Support

    Ok so the colors you can change in the Customizer, to add the borders use this CSS:

    .main-navigation ul.menu > li {
        border-left: 1px solid #fff;
    }
    .inside-navigation {
        box-sizing: border-box;
    }

    The second rule for box-sizing will stop the nav from expanding to wider than the screen

    #748286
    Kritish

    Thanks for the help!

    #748311
    Kritish

    Hi David,

    I just noticed the line goes all the way down to the submenu as well on my site, I only needed the white line for the main menu not anything under it.

    #748648
    David
    Staff
    Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.