Support » Plugin: Shortcode in Menus » shortcode in menu description

  • Resolved IT Hertz

    (@it-hertz)



    It works fine as a nav menu item, but it would be great if it could work in an existing item’s Description area.

    What I’m trying to do is place a news ticker in a menu item’s Description area using Horizontal Scrolling Announcement plugin.
    When I place the scrolling shortcode in the Description box, it calls the plugin, but it shows as “No announcement available”.
    So, for now, I have to add the ticker as a separate menu item, which doesn’t look right, because the theme/look I have inserts horizontal line separators between each item in the vertical menu/navbar.

    Can you tell me what to change in this plugin’s index.php file to provide this functionality, or would it require more extensive modification of the theme (KingSize) files as well? If you can point me in the right direction, I’m sure I can do those mods as well.

    Thanks.

    https://wordpress.org/plugins/shortcode-in-menus/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I tried to do this via CSS and simply remove the item separator line from above the shortcode and then negative margin the ticker up to where the item description normally resides, but that didn’t go well.

    I then tried using this plugin’s function has_shortcode( $content ) { and inserted the $item_output = do_shortcode( $item->description ); into my theme’s menu-walker.php, but no joy. 8-/

    Ok, I managed to get the ticker in the Description space by inserting the following above the similar <h6> line in menu-walker.php: $description = ! empty( $item>description ) ? '<div class="desc menuticker '.$selc.'">'.do_shortcode( $item->description ).'</div>' : '';
    and then commenting out the original line.

    With a little CSS magic, some div work and the has_shortcode function, it shouldn’t be too difficult to have a customized menu description and/or shortcode ticker in the description area and make it clickable or not.

    I ended up just doing it with CSS alone to eliminate the separator border between the shortcode item and the item above it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘shortcode in menu description’ is closed to new replies.