/**
 * Create a shortcode to display a menu item
 * @since 1.1
 */
function fdm_menu_item_shortcode($atts)
{
    // Define shortcode attributes
    $menu_item_atts = array('id' => null, 'layout' => 'classic', 'singular' => true);
    // Create filter so addons can modify the accepted attributes
    $menu_item_atts = apply_filters('fdm_shortcode_menu_item_atts', $menu_item_atts);
    // Extract the shortcode attributes
    $args = shortcode_atts($menu_item_atts, $atts);
    // Render menu
    fdm_load_view_files();
    $menuitem = new fdmViewItem($args);
    return $menuitem->render();
}
 /**
  * Print the menu on menu post type pages
  * @since 1.1
  */
 function append_to_content($content)
 {
     global $post;
     if (!is_main_query() || !in_the_loop() || FDM_MENU_POST_TYPE !== $post->post_type && FDM_MENUITEM_POST_TYPE !== $post->post_type) {
         return $content;
     }
     // We must disable this filter while we're rendering the menu in order to
     // prevent it from falling into a recursive loop with each menu item's
     // content.
     remove_action('the_content', array($this, 'append_to_content'));
     fdm_load_view_files();
     $args = array('id' => $post->ID, 'show_content' => true);
     if (FDM_MENUITEM_POST_TYPE == $post->post_type) {
         $args['singular'] = true;
     }
     $args = apply_filters('fdm_menu_args', $args);
     // Initialize and render the view
     if (FDM_MENU_POST_TYPE == $post->post_type) {
         $menu = new fdmViewMenu($args);
     } else {
         $menu = new fdmViewItem($args);
     }
     $content = $menu->render();
     // Restore this filter
     add_action('the_content', array($this, 'append_to_content'));
     return $content;
 }