wordpress custom walker for thumbnails with custom menu
Add a semicolon ; after get_the_post_thumbnail( $id ): get_the_post_thumbnail( $id );
Add a semicolon ; after get_the_post_thumbnail( $id ): get_the_post_thumbnail( $id );
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 Walker_Nav_Menu_Edit { public function start_el( &$output, $item, $depth = 0, $args … Read more
Sounds like you want to check the $depth variable. A depth of 0 is a top level item, a depth of 1 is a child of a top level item, etc. So in keeping with your current code, you could factor out that logic this way: $format=”%1$s<a%2$s><div>%3$s%4$s%5$s</div></a>%6$s”; if( $depth > 0 ) $format=”%1$s<a%2$s><div class=”flintstone-nav”>%3$s%4$s%5$s</div></a>%6$s”; $item_output … Read more
There are several steps to creating additional menus using the new menu system in WordPress in the TwentyTen theme or any WordPress theme (of which some of these steps can be done out of order). In addition, I’m going to highly recommend you create a child theme based on TwentyTen instead of modifying it directly: … Read more
you can do this, it hides the menu (thats all , they can still go to the menu url if they know it), based on capability. You can easily change it to role or even username. I think user role is “user_role” and for username it is “user_login”. The example below uses “user_level” of 10 … Read more
you can add them with the filter wp_get_nav_menu_items add_filter(“wp_get_nav_menu_items”, function ($items, $menu, $args) { // don’t add child categories in administration of menus if (is_admin()) { return $items; } foreach ($items as $index => $i) { if (“category” !== $i->object) { continue; } $term_children = get_term_children($i->object_id, “category”); // add child categories foreach ($term_children as $index2 … Read more
Remove the description from the user meta value managenav-menuscolumnshidden: add_filter( ‘manage_nav-menus_columns’, ‘enable_nav_menu_description_by_default’ ); function enable_nav_menu_description_by_default( $columns ) { $desc_key = ‘managenav-menuscolumnshidden’; $hidden = get_user_option( $desc_key ); $user_id = wp_get_current_user()->ID; if ( ! $hidden ) { update_user_option( $user_id, $desc_key, array ( 0 => ‘link-target’, 1 => ‘css-classes’, 2 => ‘xfn’ ) ); } elseif ( FALSE … Read more
There are two ways of doing this: Javascript. You could use JQuery to select the <li> that have <ul> children of class ‘sub-menu’, inserting content, or appending a CSS class which you then style. For example: $(‘.sub-menu’).parent().addClass(‘myclass’) PHP, a new walker function. Copy the code from wp-includes/nav-menu-template.php (until approx line 109) into your themes functions.php … Read more
i just did this for a site i am working on. first i registered 2 menus in functions.php: add_action(‘init’,’kia_menus’); function kia_menus(){ register_nav_menus( array(‘primary-menu’ => __( ‘Primary Menu for Logged In Users’, ‘kia_theme’ ), ‘primary-loggedout’ => __( ‘Primary Menu for Logged Out Visitors’, ‘kia_theme’) )); } and then where i want the 1 menu to appear … Read more
I can somehow understand what you are asking for but I think you should make this more clear. You already posted an example, but I think the main problem is: You connect some type of data to each other which is not known to wordpress. So as long as you don’t provide some hint how … Read more