' . __( 'Add Menu', 'page-builder-framework' ) . ''; } } /** * Add description to main menu items. * * @param string $item_output The menu item's starting HTML output. * @param object $item The menu item data object. * @param integer $depth Depth of menu item. * @param object $args The arguments. * * @return string The updated menu item's starting HTML output. */ function wpbf_menu_description( $item_output, $item, $depth, $args ) { if ( 'main_menu' === $args->theme_location && strlen( $item->description ) > 1 ) { $item_output .= '
' . $item->description . '
'; } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'wpbf_menu_description', 10, 4 ); /** * Allow HTML inside menu item description. * * @param object $menu_item The menu item object. * * @return object The updated menu item object. */ function wpbf_menu_description_html( $menu_item ) { if ( isset( $menu_item->post_type ) && 'nav_menu_item' === $menu_item->post_type ) { $menu_item->description = apply_filters( 'nav_menu_description', $menu_item->post_content ); } return $menu_item; } remove_filter( 'nav_menu_description', 'strip_tags' ); add_filter( 'wp_setup_nav_menu_item', 'wpbf_menu_description_html' ); /** * Remove "Background" customizer link from Appearance menu. */ function wpbf_remove_background_link() { global $submenu; foreach ( $submenu['themes.php'] as $menu_index => $theme_menu ) { if ( 'Background' === $theme_menu[0] ) { unset( $submenu['themes.php'][$menu_index] ); } } } add_action( 'admin_menu', 'wpbf_remove_background_link', 999 );