I would like to query most of my pages and categories on the homepage. So far I am able to get the pages and category (posts), but I cannot order the list the way I want to. I want to be able to get a custom order like page, posts from a category, another page, and posts from another category. I am using the following: <?php $args = array( 'cat' => $current, 'post_type' => array( 'page', 'post'), 'orderby' => 'ID' …
I've reordered the admin menu items through: function custom_menu_order($menu_ord) { if (!$menu_ord) return true; return array( 'index.php', // Dashboard 'edit.php?post_type=page', // Pages 'edit.php?post_type=sp_faq', // FAQs 'gf_edit_forms', // Forms 'woocommerce', // Woocommerce 'edit.php?post_type=product', //Products 'edit.php', // Posts/News 'edit.php?post_type=event', // Events 'upload.php', // Media 'themes.php', // Appearance 'plugins.php', // Plugins 'users.php', // Users 'tools.php', // Tools 'options-general.php', // Settings ); } add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order add_filter('menu_order', 'custom_menu_order'); This works great for the Admin user role, however, does not work for other …
I have created custom post type in back end with sort menu_order post as you can see in the screenshot. http://prntscr.com/gacw95 In back end sorting ASCENDING/DESCENDING working fine. But I need to Sort ASC/DESC on the front side also. When I click on order tab in back end It will be sorting the post in back end but not in front end. How can I sort the custom post in front side when change in the back end? Backend code …
First-timer here! I'm trying to change the order of pages on my boardgame webpage, as displayed on the top banner www.mangakagame.com . Basically, I've used "Edit" in the Dashboard and adjusted all the "order" attributes, but nothing changes. It's still using chronological ordering. The "Simple Page Ordering" plugin didn't do anything either. Weirder still, I tried to set one of the pages to "Private" but it still shows up in the banner! :/ It just links to an "Oops! That …
I wanted to change the default taxonomy terms order by its 'term_order' value instead of 'name' in admin side. So I tried something like below. But it doesn't work and php memory exhaust. function uc_order_term( $wp_query ) { $wp_query->query( array( 'taxonomy' => 'category', 'orderby' => 'term_order', 'order' => 'ASC' ) ); } add_action( 'pre_get_terms', 'uc_order_term'); However in similar way I tried to sort posts by menu_order and it works. function uc_order_post( $wp_query ) { $wp_query->set('orderby', 'menu_order'); $wp_query->set('order', 'ASC'); } add_action( …
I have a custom-post-type called 'artists'. I list them by the order attribute (menu_order). $args = array( 'post_status' => 'publish', 'post_type' => array('artists), 'orderby'=> array('menu_order'=>'ASC' ), ); $wp_query = new WP_Query( $args ); When I use the_post_navigation() to get the previous and next links, it takes the date as the order instead of the menu_order. How can I get it to work right in this case?
Context Post Type: Resources Taxonomy: Media Type, Term: Audio Taxonomy: Series The following code displays a unique list of the custom taxonomy "Series" I want to order the list by term_order, but it is not working. Any suggestions? The site. Currently it's ordered by ID <?php $post_data = array(); $my_query = new WP_Query( array( 'post_type' => 'resource', 'posts_per_page' => -1, 'media_type' => 'audio' ) ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); $post_data[] = get_the_ID(); } …
I'm not able to reorder WP Admin menu items when pages added with add_menu_page have complicated slugs. At least I think that's the problem... First I create the custom menu items, which is working as expected: function sma_simplify_admin_ui() { global $user_ID; if ( $user_ID != 1 ) { add_menu_page( 'Menu', 'Menu', 'edit_posts', 'nav-menus.php?action=edit&menu=16', '', 'dashicons-menu' ); add_menu_page( 'Memberships', 'Memberships', 'edit_posts', 'edit.php?post_type=wc_user_membership', '', 'dashicons-groups' ); } } add_action( 'admin_init', 'sma_simplify_admin_ui' ); The new items cannot be reordered. If I put the …
My menu list is so long. If I want to move an item to the top of the list, I need to hold and scroll all the way up. This is inefficient and annoying. Is there any way to improve this process?
I've activated the Order feature for my 'portfolio' CPT and have managed to arrange my 'portfolio' posts according to respective Order values I've provided. Unfortunately, I've found that this code locks the order that 'portfolio' items are displayed in admin; I can't toggle the Title ascending/descending feature nor am I able to sort this list by Date. My goal is to display these 'portfolio' items on the live site using the Order feature but I'd still like to be able …
Is it possible to get posts where menu_order is more than 0? I have tried this argument when I get_posts() but it doesn't have any effect at all: 'meta_query' => array( 'key' => 'menu_order' , 'value' => '0' , 'compare' => '>' ) What I'm after in the first place is to treat menu_order 0 as last priority, or "specific menu_order not set" so that if I set a post to 1 or 2 as menu_order. Those posts will be …
Having some trouble with a clients site. We have a product with four upsell products linked, and they display on the site. Only problem is, those products are listed on the page in a seemingly random order (IE, no correlation between ID's, post dates, names etc). What we want, is for those products to be shown, as inputted in the back end. This is currently the code set up we currently have going on (as far as I'm aware, this …
I need to rearrange the posts by ordering them from published date instead of alphabetical order in Menu posts selection panel, view all section. I want them to order as same way in the most recent posts in the view all section as well. Is it possible to achieve this via a hook or any other code ?
We're looking to add two new (custom post type) entries between Dashboard and Posts. In this project, for the end user, two items are going to be by far the most used items in his dashboard. So we want them at the top. These seem to be the built in menu_position settings: This only gives a single slot, menu_position=3, between Dashboard and Posts. And we need two slots! What we've tried: 1) Using decimals - as strings - is sometimes …
How can I get all items under specific parent and order them by menu order in hierarchical Custom Post Type? Lets say I have this posts structure: Fruits Apples Bananas Plum Cherry Vegetables Potatoes Beans Beet Nuts Walnut Chia seeds This doesn't work: $args = array( 'post_type' => 'vile', 'posts_per_page' => -1, 'post_parent__in' => array(543), // Only children of Fruits or Vegetables or Nuts 'order' => 'ASC', 'orderby' => 'menu_order' ); $query = new WP_Query($args); Registering CPT add_action( 'init', 'register_vile', …
I want to add a logo to my main menu. I am using this function: add_filter( 'wp_nav_menu_items', 'add_logo_to_menu_item', 10, 2 ); function add_logo_to_menu_item ( $items, $args ) { if ($args->menu == 'main-menu') { $items .= '<li><a href="#"><img src="PATH_TO_IMAGE"></a></li>'; } return $items; } The problem I am having is I want the logo to be at the top of the menu. This filter currently places it in the last position of the menu. Any ideas?
I would like to change the priority/menu order of the "Media" admin page. Is there a way to change that via apply_filter? Is there a way to change only "Media" page priority without having to list all pages within menu_order? Thanks
I have made a menu in the admin page ordered like this: parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - child 3 When I load them in my navbar with the following code it works just fine: wp_nav_menu( array( 'theme_location' => 'menu-1', 'menu_id' => 'primary-menu', 'menu_class' => 'top-menu', ) ); However, I want to load a specific menu on a …
So I have 3 custom post types that I want to order by menu_order & have 'date' as the fallback parameter as the majority of posts will have the default menu order of '0'. It would be nice if pre_get_posts would do this relatively simply (as opposed to something like this - Multiple orderby parameters in pre_get_posts() action), but not looking probable. This works fine with posts where menu order is set to specific value, where it is 0, the …