Articles of menus

How to assign a WP 3.0 custom nav menu to a theme's navigation menu location via script?

I’m using this script inside a plugin to create a new custom menu on the fly and assign a page to it… $menu_id = wp_create_nav_menu( ‘header-menu’ ); $menu = array( ‘menu-item-type’ => ‘custom’, ‘menu-item-url’ => get_home_url(‘/’),’menu-item-title’ => ‘Home’, ‘menu-item-status’ => ‘publish’ ); wp_update_nav_menu_item( $menu_id, 0, $menu ); And this works great. However, what I’m stuck […]

Get menu links only

I’m creating a template in HTML5. On navigatiom menu i need to implement something like this <nav> <a href=”url1″>url1</a> <a href=”url1″>url2</a> <a href=”url1″>url3</a> <a href=”url1″>url4</a> … <a href=”urln”>urln</a> </nav> If i use ‘wp_nav_menu’, it prints <div><ul><li><a> when i need just <a> There is a way to get that? Thanks!

Why do the menu titles change with the renaming of pages?

I’ve created a custom menu using pages. For a lot of the list items, I’ve specified a custom menu title for the page… So, the About Us page becomes About on the menu, for example. Then, when the page title is changed, it’s changing the title on the menu as well. So if I change […]

Custom Menus, Widgets & Conditional Statements

I’m employing custom widgets for my client because it’s easy and they have several menus they need to create specific to site sections. I then want to allow them to add to the custom menu dynamically using widgets (I create the spaces needed for the widget and they drag and drop the menus into that […]

Add a #hash to the links in my custom menu

I have created a static frontpage where I load in the content of all my pages. Now I have a normal custom menu, but the links refer to the pages, for example: http://mysite.com/about Now the I want to have the link directed to the page itself with http://mysite.com/#about. Now I have a custom walker that […]

wp_nav_menu() mark current item ancestor of custom post type

This solution does almost what I want it to. Only thing is, I have my menu set up as follows: Menu item 1 Menu item 2 Custom post type 1 Custom post type 2 Custom post type 3 Menu item 3 Using the solution I mention adds the tag “current_url” to the sub menu of […]

Add nav menu CSS class to body

I would like to add the CSS class of the current menu item (and the classes of its parents & ancestors) to the current page body classes. For example, if the current menu item has a CSS class “products” (as defined in Appearance | Menus), then the body for the corresponding page should also have […]

display only the wp_nav_menu, which has the current-menu-item

i have a problem displaying only the menu with wp_nav_menu, in which the current-menu-item is in. Heres what i got: function register_menus() { register_nav_menus( array( ‘sidebar-menu’ => __(‘Sidebar Menu’), ‘first-menu’ => __(‘Menu 1’), ‘second-menu’ => __(‘Menu 2’), ‘third-menu’ => __(‘Menu 3’) ) ); } add_action(‘init’, ‘register_menus’) and on the page.php i’m doing <?php wp_nav_menu(array(‘theme_location’ => […]

Create a Page via plugin

My problem is to show a list of products read from db tables. I know how to read them and I am able to produce the table, but only using a shortcode embedded in a page that I’ve created via WP. I want the plugin itself create a page with my table inside, and that […]

Where to update the Static Pages Blacklist for Multisite Install?

Where in the menu system is the link to this blacklist? As referenced in the codex https://codex.wordpress.org/Multisite_Network_Administration Also note that the blog prefix is not used for static pages which will be accessible directly under the base address, e.g. domain.com/PAGENAME. If you try to create a static page in the first site with the name […]