Tag Info

New answers tagged

0

Under "Settings" -> "Reading" in the wp-admin you (or other users) can set which page should be used as the home page.


2

When you're under Appearance > Menus, there should be a link in the top right-hand corner of the screen titled "Screen Options." Check "Categories" or anything else in order to add other items to the menus. This is useful in other pages of the dashboard as well, because some important items (post revisions for example) are hidden there.


0

your problem is in your use 'menu_class' and 'items_wrap' not synchronized. You can edit : wp_nav_menu( array( 'theme_location' => 'header-menu', 'container' => '', 'echo' => '0', 'menu_class' => 'nav-menu horiz-menu container sixteen columns', 'items_wrap' => ...


1

The question is light on detail but I'd lean toward a custom Walker: class My_Page_Walker extends Walker_Page { function end_el( &$output, $page, $depth = 0, $args = array() ) { $output .= '<span>After the Anchor</span></li>'; } } $args = array( 'walker' => new My_Page_Walker ); wp_list_pages( $args ); That should ...


1

This ended up doing the trick. function auto_hashtag( $menu_item ) { if ( ! is_admin() && $menu_item->post_parent > 0) { // url $url = $menu_item->url; $menu_item->url = preg_replace('!/([^/]+)/$!', "/#\\1", $url); } return $menu_item; } add_filter( 'wp_setup_nav_menu_item', 'auto_hashtag' );


0

What you are trying to do seems like a bad idea; the # symbol is used at the end of a URL to denote an anchor position for the website to scroll to. Take for example this very page with this link: Add # to submenu URLs automatically When clicked, it moved the screen down to the <div> tag with an id of post-form. In the example you give ...


2

These fields are created in Walker_Nav_Menu_Edit::start_el(). To change or to remove them, create a custom walker (example for another walker) that extends Walker_Nav_Menu_Edit and uses other or less fields. Then filter wp_edit_nav_menu_walker and return the class name of your walker. Pseudo-code: class Walker_Nav_Menu_Edit_Simple extends ...


-1

Code is here: Wordpress chained categories I write the same code for categories. You can edit for your needs. I used the that js plugin: http://www.appelsiini.net/projects/chained


0

Here's a function I use to add a first / last class to wp_nav_menu() items: function add_first_and_last($items) { $items[1]->classes[] = 'first'; $items[count($items)]->classes[] = 'last'; return $items; } add_filter('wp_nav_menu_objects', 'add_first_and_last');


0

After several iterations with the wp_update_nav_menu_item function (see below) i just looked through the code to see what WP does itself in case an admin clicks on the "Delete" link of a menu entry. Turns out that it simply calls wp_delete_post for that specific menu entry and that is that. Nothing else, nothing fancy. So in case you want to delete a menu ...


0

It seems to me that you could handle this through CSS in that you could hide the lower level menu options by default, and then choose to show them if they have certain classes above them. On this Codex page, you can see the menu classes (and on your page itself). So for the "second level" you described, assuming the first level menu is level 1 - not 0. ul ...


1

I think I got the answer: function my_nav_menu( $args = array() ) { $echo = isset( $args['echo'] ) ? (bool)( $args['echo'] ) : true; $args['echo'] = false; add_filter( 'wp_nav_menu_objects' , 'my_filter_nav_menu' , 100 , 2 ); $menu = wp_nav_menu( $args ); remove_filter( 'wp_nav_menu_objects' , 'my_filter_nav_menu' , 100, 2 ); ...


0

Given that the markup of your menu does not seems to generating all of the classes I'd expect to see, I'll guess at the problem. Your theme is using a custom Walker Or something-- theme or plugin-- has added a filter to (probably) wp_nav_menu_css. Though there are other filters that could be used. To fix it, or try to, make sure your theme does not ...


0

I think the wholee problem is your trying to use the default walker, but by declaring it in the walker field your telling wordpress your trying to load a custom walker, the wp walker is loaded by default if left empty. two options: 1/ change 'walker' => new Walker_Nav_Menu() to 'walker' => '' as its called by default. 2/ edit declaration to a new name ...


0

For me what worked was this: <?php wp_nav_menu( array( 'container' => '', 'items_wrap' => '%3$s' ) ); ?> Hope it helps.


1

show_home isn't working for you because there is no show_home argument on wp_nav_menu. You will need to add it using the menu editor in the admin panel, most likely as a custom link. These are the valid arguments: $defaults = array( 'theme_location' => '', 'menu' => '', 'container' => 'div', 'container_class' ...


1

To be honest I think you can just use some custom css to get the job done. Wordpress gives the homepage a custom body class of home. so if we use that and dig down in the css to the first menu and move it over into view you should be good. .home .menu > li > ul { left: 0; } and to get the hover state on the 'Data' link just use .home #header .menu ...


0

I've had this happen to me in the past at least 3-4 times but I don't really know what caused it. More often than not I was able to solve it by deleting the menu I was having problems with and creating a new one.


-2

You need to save the menu name first when you create it. After which you can add menu items to the menu. There may be issues with a conflict on the name of the menu. The database updates with WordPress 3.8.1 may have not update. Try re-updating Wordpress, if that doesn't work, and it isn't an issue with plugins then go to the next paragraph. Also for me ...


1

There is a fix coming up for the same, here is the ticket: https://core.trac.wordpress.org/changeset/27755 In case you need it urgently, you can give this a try Original Answer by @goldenapples, here is the link: Dynamic navigation for custom post type (pages) function wp_list_post_types( $args ) { $defaults = array( 'numberposts' => -1, ...


0

You could either extend the Walker_Nav_Menu walker class (i.e., the start_el function is sufficient, as already mentioned). Or you could hook in when the original output (i.e., the category) has been created. That would be the walker_nav_menu_start_el hook. For instance like so: function wpdev_139801_start_el( $item_output, $item ) { if ( isset( ...


0

In addition to @Rarsts answer, once you've created a custom post type with archive like this example: //* Create product custom post type add_action( 'init', 'register_product_custom_post_type' ); function register_product_custom_post_type() { register_post_type( 'product', array( 'labels' => array( 'name' => __( ...


0

What you are looking for is custom post type archive. First you should make sure that your CPT is registered to have archive at all. Unfortunately natively WP doesn't add CPT archives as available to be included in menus. The simplest solution is just to add custom link to it. There are also multiple snippets and plugins to address this floating around, ...


0

To center the menu just edit this css code : .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { text-align: left; } to : .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { text-align: center; }


0

Problem was the theme that we purchase didn't upload the plugins and other Java Script files properly So it was giving an error. Going through theme installation document helped me.


1

Not a specific answer, but will be too long for a comment. You could also try looking at the code that WordPress core uses itself. I know you said you couldn't use the check box that auto-adds pages, but you could look over how it is being used. A little digging around (with a decent text editor you should be able to search for a phrase throughout the entire ...


2

The question is unclear but wp_nav_menu() has a couple of arguments that will allow you to add classes to the output. For example... wp_nav_menu( array( 'container_class' => 'conclass', 'menu_class' => 'menclass' ) ); You can alter those arguments using the wp_nav_menu_args filter as well. However, I suspect that when you say "class" ...


1

wp_nav_menu_items aren't mentioned in the codex, so there are no concrete description on how to use it. wp_nav_menu_items can be found on line 347 in wp-includes/nav-menu-template.php $items = apply_filters( 'wp_nav_menu_items', $items, $args ); within wp_nav_menu. In the codex, it states the following Displays a navigation menu created in ...


0

On line 28 of header.php change the class of the navbar css as follows: Replace the class navbar-relative-top with navbar-fixed-top. Therefore, line 28 becomes <div class="navbar navbar-inverse navbar-fixed-top">


0

You can try to get that information by using the get_term_by() function with the relevant parameters of the menu item (namely object and object_id) : foreach( (array) $menu_items as $key => $menu_item ) { // Match the menu items to your custom taxonomy: if( 'solutions_category' === $menu_item->object ) { // Fetch the corresponding ...



Top 50 recent answers are included