• Resolved djedje

    (@djedje)


    I’m trying to create a new menu underneath my theme’s Main Menu. I need it to have the same styling and responsiveness as the existing one..I’ve added it into functions.php and header.php and created a class for it.

    <?wp_nav_menu( array( 'theme_location' => 'new-menu', 'container_class' => 'new_menu_class' ) ); ?>

    It’s showing up – but I can’t for the life of me figure out how exactly to copy a style across from one menu to the other.

    Any ideas or pointers would be stupendously appreciated to this confused noob. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Rather than using new_menu_class, you can use the same class which you are using for your primary navigation so that you will not need to create extra CSS styles for the new menu.

    Thread Starter djedje

    (@djedje)

    Hi Biren, thanks for your reply. I’m trying to do that but it doesn’t seem that the styles are being applied to the new menu class. Here’s my code from header.php

    <header role="banner">
    
    			<div class="navbar navbar-default navbar-fixed-top">
    				<div class="container container-full">
    
    					<div class="navbar-header">
    						<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-responsive-collapse">
    							<span class="icon-bar"></span>
    							<span class="icon-bar"></span>
    							<span class="icon-bar"></span>
    						</button>
    
                                                    <?php if( $berry_redux['berry-nav-branding-logo-is-image'] == true ):  ?>
                                                    <a class="navbar-brand is-image" title="<?php echo get_bloginfo('description'); ?>" href="<?php echo home_url(); ?>">
                                                        <img class="branding-logo" src="<?php echo $berry_redux['berry-nav-branding-logo']['url']; ?>" alt="<?php echo get_bloginfo('description'); ?>">
                                                    </a>
                                                    <?php else : ?>
    						<a class="navbar-brand" title="<?php echo get_bloginfo('description'); ?>" href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
                                                    <?php endif; ?>
    					</div>
    
    					<div class="collapse navbar-collapse navbar-responsive-collapse">
    
    						<?php wp_bootstrap_main_nav(); // Adjust using Menus in WordPress Admin ?>
                            <?php wp_nav_menu( array( 'theme_location' => 'new-menu', 'container_class' => 'navbar-responsive-collapse' ) ); ?>
    Moderator bcworkz

    (@bcworkz)

    For CSS issues, the PHP code is not that helpful. A link to the page in question would be much more helpful.

    It’s possible for identical HTML classes to not be styled the same if CSS is written in a certain way. With a live link we can see the actual HTML output as well as the CSS rules. That’s what we really need to help you.

    If that’s not possible, you can do what we would do – look at your page with your browser’s developer tools to see what rules are applied where, which would lead to why they are not applied to similar HTML. If you’ve not used the developer tools, you should start, it’s essential to working with CSS in WP.

    Thread Starter djedje

    (@djedje)

    In the end I realised that calling multiple classes through php does not required commas, in that way I managed to apply existing styles to my new menu.

    Thanks bcworkz, using the developer tools I found out which CSS classes were applied to each element.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Copy (most of) style to newly created menu’ is closed to new replies.