Show parent’s child and also child’s, child on a page?

Will get_pages() work for you? http://codex.wordpress.org/Function_Reference/get_pages If I’m understanding your question correctly, you would want something like this: $children_of_page = get_pages(array( ‘child_of’ => $post->ID, ‘parent’ => $post->ID //defining both parent and child forces the list to only include direct children. )); $children_of_first_child = get_pages(array( ‘child_of’ => $children_of_page[0][ID], ‘parent’ => $children_of_page[0][ID] )); If you wanted to … Read more

wp_nav_menu not selecting teh correct menu

I faced the same issue and finally got the answer: For functions.php: register_nav_menu( ‘primary’, __( ‘Navigation Menu’, ‘Removemymug_Theme’ ) ); register_nav_menu( ‘second-menu’, __( ‘Second Menu’, ‘Removemymug_Theme’ ) ); For Secondary Menu (Footer): wp_nav_menu( array( ‘menu’ => ‘second-menu’, ‘theme_location’ => ‘second-menu’, ‘depth’ => 2, ‘container’ => ‘div’, ‘container_class’ => ‘navbar-collapse collapse’, ‘menu_class’ => ‘nav navbar-nav navbar-right’, … Read more

current_menu_parent for custom post type and custom url

Ended up hooking the nav_menu_css_class filter, and adding the appropriate class when needed. Like this: add_filter( ‘nav_menu_css_class’, ‘add_parent_menu_class’, 10, 2 ); function add_parent_menu_class( $classes, $item ) { $post = get_post(); if ( ! $post ) { return $classes; } if ( $item->url === get_bloginfo( ‘url’ ) . ‘/custom_url’ && get_post_type() == $this->post_type ) { $classes[] … Read more

add custom entries to menu options

Here a very quick example. The idea is to add a new meta box in the menu configuration. add_meta_box is used in admin_head-nav-menus.php page: class Custom_Nav { function __construct() { add_action( ‘admin_head-nav-menus.php’, array( $this, ‘add_nav_menu_meta_boxes’ ) ); } public function add_nav_menu_meta_boxes() { add_meta_box( ‘custom_links’, __(‘Custom links’), array( $this, ‘nav_menu_link’), ‘nav-menus’, ‘side’, ‘low’ ); } public … Read more

Active class not working on custom menu link using add_menu_page

Well, it is quite a hack I propose, but I would suggest the following: add_action( ‘admin_head’, ‘chg_menu_on_special_pages_page’ ); function chg_menu_on_special_pages_page(){ global $parent_file; $gallery_page_id = 2; if( $parent_file != ‘edit.php?post_type=page’ ) return; if( ! isset( $_GET[‘post’] ) || $_GET[‘post’] != $gallery_page_id ) return; $parent_file=”post.php?post=”. $gallery_page_id .’&action=edit’; return; } By the global $parent_file it is decided, which … Read more

WordPress menus – automatically generate

Use the WP database (via proper methods) to store a ‘is this the first run’ flag? Then just conditionally execute. check for flag in wp db if exist do nothing if not exist create me my menus dag nammit remember to set flag for next round so its only done once Something like that? If … Read more

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