Skip to:

Hard-coding a shortcode as the last menu item…WORKS…question about shortcodes in menu

  • Avatar of admin25


    Hello, I am using the following code to get a shortcode in my menu and it works, the dropdown menu is there.

    I notice that some shortcodes work (execute as a menu item) and some do not.

    e.g the shotcodes for say; contact form 7 work, but, shortcodes that give a list of links say for a blogroll or from Bowe Codes for the list of groups a user belongs to dose not work.

    And this last is what I was hoping to do, add a menu dropdown with the logged in users list of groups they belong to.

    Is it possible to force a shortcode that outputs a list to execute as a menu item?

    Thanks for any help.

    `function my_contact_item($items, $args) {
    if( $args->theme_location == ‘primary’ )
    return $items . ‘

  • My link title
  • ‘;
    add_filter(‘wp_nav_menu_items’,’my_contact_item’, 10, 4);`

You must be logged in to reply to this topic.