Wrap span around menu item

Home Forums Support Wrap span around menu item

Home Forums Support Wrap span around menu item

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #201643
    Marcel

    Hi,

    I need to additionally wrap each menu item in a span. I tried to add
    ‘link_before’ => ‘<span>’,
    ‘link_after’ => ‘</span>’,
    into the wp_nav_menu and add the navigation.php to my child theme but there is no effect.

    Any idea how to could achiev this?

    Thanks in advance
    Marcel

    #201678
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you show me the code you added? Be sure to highlight it and click the “code” button in the editor here ๐Ÿ™‚

    #201756
    Marcel

    Hi,
    thanks for getting back so quick.

    In the navigation.php from the inc directory I added the link_before and link_after inside here (line 94):

    wp_nav_menu( 
    array( 
    	'theme_location' => 'primary',
    	'container' => 'div',
    	'container_class' => 'main-nav',
    	'container_id' => 'primary-menu',
    	'menu_class' => '',
    	'fallback_cb' => 'generate_menu_fallback',
    	'link_before' => '<span>',
    	'link_after' => '</span>',
    	'items_wrap' => '<ul id="%1$s" class="%2$s ' . join( ' ', generate_get_menu_class() ) . '">%3$s</ul>'
    				) 

    I’m using Menu Plus with a sticky menu by the way. I don’t know if have to adjust other files as well or if I have to switch to jquery to force the span around.

    Would be great if you could get me on the right track with this.

    All the best
    Marcel

    #201770
    Tom
    Lead Developer
    Lead Developer

    Hmm, tough one.

    Just as a test, what happens if you wrap your navigation labels in span tags inside “Appearance > Menus”? Does that insert them into the correct area?

    #201798
    Marcel

    Hi Tom,

    thanks it does the trick tough I would have preferred a way without touching the menu hardcoded but all good. Another quick question then I let you off the hook ๐Ÿ˜‰

    I tried to display the post thumbnail in the single article but it won’t show off. What do I have to do to make it work?

    I already added add_theme_support( ‘post-thumbnails’ ); in my functions.php
    I use the Masonry look but that should not affect the appearance of the single article.
    I want to have the post thumbnail displayed at 100% width preferable as a scaling background image but I’m not quiet sure how to set it up.

    Thanks in advance
    Marcel

    #201805
    Marcel

    Hi again,

    found the error myelf.
    If you try to use sections in the backend editor the post thumbnail is not displayed.
    It only shows up when using the regular editor mode.

    Don’t know if you realised but it would be great to use the sections on pages and articles in the future. Other than that: Great job on the add-ons as always.

    Cheers,
    Marcel

    #201963
    Tom
    Lead Developer
    Lead Developer

    Ah yes, Sections will remove the featured image, sidebars etc..

    This allows you to add the image inside your top section and apply whatever necessary styles to it.

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