Are you looking to put a title on the nav links? That is built into the Menu feature in WordPress.
But this applies to the tag and not the <li>
as you specified. You can, however, apply a class to the <li>
by clicking the “Screen Options” link while in the Menu Admin page. Then, find the “CSS Class” checkbox under “Show advanced menu properties”.
Finally, you could give your links the desired title and then apply the following jQuery to apply the title to the <li>
and remove it from the <a>
.
$(function() {
$('ul li').each(function() {
var linkTitle = $(this).find('a').attr('title'); //get the link title
$(this).attr('title', linkTitle); //apply the title to the li
$(this).find('a').removeAttr('title');
});
});
JSFiddle example: http://jsfiddle.net/tmort/E5VzC/3/
Related Posts:
- Add Dividers or Separators Between Nav Menu Items
- Replacing WordPress menu functionality with a plugin
- PHP 7 – Class Method Compatibility Issue
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- add_menu_page() with different name for first submenu item
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- How do I programatically insert a new menu item?
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- Header Button Chance Polylang Elementor
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Get Current Menu Location inside Nav_Walker
- Adding custom fields to WordPress nav menus
- Sub Menu content is being duplicated
- Plugin menu addition in multisite
- Remove unwanted elements for a wp_nav_menu
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Add child pages to submenu automatically
- Customize existing menu item
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- How to create archive page to add in menu
- How to show only the last two categories in a menu?
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- Navigate to external link if last page or post in a category
- How can I add recent posts to menu like mashable
- What happens when you create/edit a menu
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Create and style menu
- Change the class of wordpress menu
- How can I create a navigation menu in the sidebar that can also act like a slider?
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Hide menu items from not logged in users
- adding an options menu that allows saving multiple sets of said options
- How to give a NavWalker its own stylesheet?
- Remove a class from a using Walker
- Preventing double loading JS scripts (like React) when developing for Gutenberg
- Pass CF7 form data to plugin
- How to add custom post widgets as tags into wordpress
- How to display the specific post content by using POST ID
- Should I use wp-content/cache or [PLUGIN_DIR]/cache?
- How to register my code as a plugin
- Secruity Questions on a timer
- Adding a custom taxonomy to “nav_menu_item”
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- AJAX button with success callback. (Titan Framework)
- Is there any way to fire heartbeat API from for website visitors?
- Menu Custom Data Attributes
- How to output functions from plugin inside theme
- ajax working when function is on child theme but not in plugin page
- modify show UI of a registered taxonomy
- I need to refresh page to display wp_get_current_user() : why?
- Look for a file in a theme before loading from plugin
- AJAX call to admin-ajax.php by subscriber returns home page
- My navigation menu isn’t working. What happened? Please help!
- Using function from enqueued .js file in theme in plugin?
- how to save wp_editor html content in options table
- Sharing Variables between scheduled events
- Custom Plugin Options Won’t Update
- What is the way to hook all wordpress email
- How can I programmatically change a MySql variable (foreign_keys_check)?
- Configure WordPress to Generate Scheme-less Relative URLs
- The cart, checkout, and shop links not getting removed
- How to use gettext for specific user role
- Hide one specific woocoomerce product
- Problem with display data from get_option
- wp_schedule_event is registered but function isn’t running
- Empty Array is Giving Warning for array_merge()
- Custom Post Type Object – Undefined Variables
- settings api – add_settings_section not working
- Enqueue a file that’s not js or css