Use AJAX in shortcode

First off, this is very borderline within the scope of WPSE, it at all. Apart from the shortcode to trigger the initial HTML output, this is really just AJAX. Anyhow, that being said, this is how it’s done: The PHP Assuming that the above PHP snippet you supplied is functional, place the following in a … Read more

Displaying Custom Post Types In “At A Glance” Meta Box

Here is the function that I use to display CPT in the “At a glance” widget add_action( ‘dashboard_glance_items’, ‘cpad_at_glance_content_table_end’ ); function cpad_at_glance_content_table_end() { $args = array( ‘public’ => true, ‘_builtin’ => false ); $output=”object”; $operator=”and”; $post_types = get_post_types( $args, $output, $operator ); foreach ( $post_types as $post_type ) { $num_posts = wp_count_posts( $post_type->name ); $num … Read more

Get menu object from theme_location

This method looks like what you’re looking for, using get_nav_menu_locations() and get_term(): $theme_locations = get_nav_menu_locations(); $menu_obj = get_term( $theme_locations[$theme_location], ‘nav_menu’ ); $menu_name = $menu_obj->name; (See the link for the whole thing wrapped up in a custom function; the above code just highlights the relevant WP functions for getting what you’re after.)