Move admin menu at the end

The global variable $menu can be manipulated. Here, we are moving the Pages menu item to the end: Maybe there’s a simpler method to do the recursive array search, I’ve grabbed an example from PHP Manual. The value to be searched has to be inspected inside the $menu var, enable the debug lines to brute … Read more

Change menu with language?

Solved it with add_meta_box in functions.php. Here is my code: add_action( ‘add_meta_boxes’, ‘my_custom_box’ ); function my_custom_box(){ if ( function_exists(‘add_meta_box’) ) { add_meta_box( ‘page_custom_menu’,’page-menu’, ‘page_custom_menu_box’, ‘page’, ‘side’,’high’); add_meta_box(‘page_custom_menu’,’page-menu’, ‘page_custom_menu_box’, ‘post’, ‘side’, ‘high’); } } function page_custom_menu_box(){ global $post; if ( metadata_exists( ‘post’, $post->ID, ‘page_menu’ ) ) { $menu_id = get_post_meta( $post->ID, ‘page_menu’, true ); } $entries … Read more

Show top-level parent with submenu menu walker

You can try to skip the following if-condition in the start_el() method in your child_menu_walker class: if ($item->menu_item_parent != $parent_item_id ) { //… } which is equal to: if ($item->menu_item_parent != 0 ) { //… } since you have $parent_item_id = 0. So it looks like this condition is filtering out your top-level parent. You … Read more

How to open modal window when clicking a WP menu link?

Using bootstrap’s modal you could use this hook in your function.php file top do that: add_filter( ‘nav_menu_link_attributes’, ‘menu_atts’, 10, 3 ); function menu_atts( $atts, $item, $args ) { // The ID of the target menu item $menu_target = 24; // inspect $item if ($item->ID == $menu_target) { $atts[‘data-toggle’] = ‘modal’; $atts[‘data-target’] = ‘#IDofModal’; } return … Read more

List children of second level sub page

Is this what you are after? <?php if($post->post_parent) { // if $post has parent than it is “Second level” and show its children. $children = wp_list_pages(“child_of=”.$post->post_parent.”&echo=0″); } else { // else it’s a “Top level” so display children & grand children? $children = wp_list_pages(“child_of=”.$post->ID.”&echo=0″); } if ($children) { echo “<ul>$children</ul>”; } Source: http://codex.wordpress.org/Function_Reference/wp_list_pages#List_subpages_even_if_on_a_subpage

WordPress nav_menu_link_attributes Not Working

Whenever an attribute is empty WordPress filters decide just not to show the attribute so a simple test for this is the following: function menu_anchor_attributes ( $atts, $item, $args ) { $atts[‘data-menuanchor’] = ( ! empty( $item->attr_title ) ) ? $item->attr_title : ‘test’; return $atts; } add_filter( ‘nav_menu_link_attributes’, ‘menu_anchor_attributes’, 10, 3 ); This way, if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)