add menu page in loop menu order

Ok it took me a while, but I think I have it. I had to use usort. I also included the code for the get_top_level_pages() method. $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’, ‘posts_per_page’ => ‘-1’)); $top_level_pages = get_page_by_title(‘Locations’); $menuArray = get_page_children( $top_level_pages->ID, $all_wp_pages ); function compareOrder($a, $b) { return $a->menu_order – $b->menu_order; … Read more

How to get data from option page [closed]

I echoed out this $google_map_api_key = get_option(‘talimi_mapapi’); and its working fine. try in functions.php add require_once get_template_directory() . ‘/page-templates/theme-settings.php’; or add wp-load.php in your file. if you are using multi-site then try <?php get_site_option( $option, $default , $use_cache ) ?> reference https://codex.wordpress.org/Function_Reference/get_site_option

Not able to show the add_menu_page icon

You have added the directory name where do you have stored the icon and this should be the 6th argument rather than 5th. add_menu_page( ‘pms_rohitashv’, ‘PMS’, ‘subscriber’, ‘pms_rohitashv-main’, ”, plugin_dir_url( __FILE__ ).’/images/icon.png’ );

Highlight active Admin Menu when added though add_menu_page

add_filter( ‘parent_file’, ‘parent_file_hover’ ); function parent_file_hover( $parent_file ) { global $pagenow; if ( $pagenow == ‘post.php’) $parent_file = “post.php?post={$_REQUEST[‘post’]}&action=edit”; elseif($pagenow == ‘post-new.php’) $parent_file = “post-new.php?post_type={$_REQUEST[‘post_type’]}”; return $parent_file; }