WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Menu via shortcode isn't indenting (3 posts)

  1. juliemooster
    Member
    Posted 1 year ago #

    Hello

    I am having an issue with a menu that isn't indenting on the page when I cut and paste the menu in via shortcode.

    The page that the menu is pasted at is:
    http://s441383657.websitehome.co.uk/?page_id=35

    and the menu is meant to look like the one at this page:
    http://www.leappartnership.co.uk/contact.php

    I've configured the menu to look like it does in the page in the link just above here from within the Appearance/Menus section, but for some reason it isn't indenting at all.

    The shortcode I'm using is:
    <?php wp_nav_menu( $defaults ); ?>

    Which has the following code above it, just under the get header tag:
    <?php $defaults = array(
    'theme_location' => '',
    'menu' => 'Sub Page Menu',
    'container' => 'div',
    'container_class' => 'menu-{menu slug}-container',
    'container_id' => '',
    'menu_class' => 'menu',
    'menu_id' => '',
    'echo' => true,
    'fallback_cb' => 'wp_page_menu',
    'before' => '',
    'after' => '',
    'link_before' => '',
    'link_after' => '',
    'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s',
    'depth' => 0,
    'walker' => ''
    ); ?>

    I'm sure that this is really obvious as to what I'm doing wrong, but I can't spot it! Can anybody assist?

    Many thanks in advance.

    Kind regards

    Julian

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Looks like most if not all of your problems are CSS related.

    If you look at the rendered HTML code for the two menus, the one that is not working has an extra div:
    <div class="menu-{menu slug}-container">

    The non-working one also has this CSS code (from indexstyle.css) overriding some of the other styles:

    #menu {
        padding-left: 55px;
        padding-top: 15px;
        text-transform: uppercase;
    }

    They two menus also don't have the same classes and thus other CSS code is not applied them the same way...

    Don't know if that helps, but hope so...

  3. juliemooster
    Member
    Posted 1 year ago #

    Thank you very much indeed, that has sorted it.

Topic Closed

This topic has been closed to new replies.

About this Topic