Remove All in One Pack from the admin bar

You are almost there! If you check out where the plugin developer is adding this action, you’ll see they are setting a priority of 1000. While the priority of your function is being called at 999. https://plugins.trac.wordpress.org/browser/all-in-one-seo-pack/trunk/aioseop_class.php#L3907 Update your priority to be greater than 1000: add_action( ‘admin_bar_menu’, ‘aldous_remove_items_from_admin_bar’, 1200 ); Overriding function calls with plugins … Read more

Show menu based on parent & ancestor

Work around. if (is_page( ‘pagename’ ) || in_array(“5”, $post->ancestors)) { wp_nav_menu( array( ‘container_class’ => ‘subnav’, ‘menu’ => ‘visit’ )); } 5 being the ID of the page in question. So while this is a bit more work, needing and if / if:else statement for each page, it will scale to allow as many child / … Read more

Find the Children of a Page then Echo it as a Bulleted List of Links (menu)

Well you just need to run a foreach loop over your $children but WordPress has a build in function for this already called wp list pages. For example: $children = wp_list_pages(‘title_li=&child_of=”.$post->ID.”&echo=1’); if ($children) echo ‘<ul>’ . $children . ‘</ul>’; There is a full reference and examples here: http://codex.wordpress.org/Function_Reference/wp_list_pages

Is it possible to pass variables from add_user_page?

The easiest and most clean way to solve that problem is using a specialised object. First create a class that can hold extra information: class Menu_Page { public $extra=””; public function render() { print $this->extra; } } Now create an object from that class … $page = new Menu_Page; $page->extra=”Hello World!”; … and register its … Read more

Check if menu id = $specific_id – then insert specific

Creating a custom Walker is a valid way to solve this, and is the first thing that crossed my mind, but it is not strictly necessary. It is possible to pull this off with filters, albeit by mildly abusing one of them 🙂 Proof of concept: function insert_image_wpse_130477($item_output) { remove_filter(‘walker_nav_menu_start_el’,’insert_image_wpse_130477′); $prepend = apply_filters(‘my_item_prepend’,”); return $prepend.$item_output; … Read more

Admin Panel – Custom Menu Sub-Item LINK

Insert the URL of the page as the $menu_slug argument. Also note that user levels are deprecated, you should pass a capability instead. function add_custom_link() { add_submenu_page( ‘edit.php?post_type=cpt_custom’, ”, ‘Pending Posts’, ‘edit_posts’, ‘edit.php?post_type=cpt_custom&post_status=pending’, ” ); } add_action(‘admin_menu’, ‘add_custom_link’);

How to construct a custom html for submenus

Okays.. i’ve solved this in my own way. i have added the following function in functions.php file class ik_walker extends Walker_Nav_Menu{ //start of the sub menu wrap function start_lvl(&$output, $depth) { $output .= ‘<div class=”dropdownContain”> <div class=”dropOut”> <div class=”triangle”></div> <ul>’; } //end of the sub menu wrap function end_lvl(&$output, $depth) { $output .= ‘ </ul> … Read more