• How do I query additional custom post type posts to the reorder page of another custom post type?
    I’m using the hook pre_get_posts to show a number of custom post types in the same page in the front-end and would like to show the same posts in the reorder page in the back-office to be able to order them accordingly.
    Thank you.

Viewing 1 replies (of 1 total)
  • Thread Starter diogobento

    (@diogobento)

    I’ve tried this but it’s not doing the last condition:

    
    function sc_pre_get_posts($query) {
    	if (!is_admin() && $query->is_main_query()) {
    		if ($query->is_home()) {
    			$query->set('post_type', 'frontpage');
    			$query->set('posts_per_page', '-1');
    		}
    		elseif ($query->is_post_type_archive('works')) {
    			$query->set('post_type', array('works', 'education', 'transarkiv'));
    			$query->set('posts_per_page', '-1');
    		}		
    	}
    	elseif (is_admin() && is_page('order-post-types-works')) {
    		$query->set('post_type', array('works', 'education', 'transarkiv'));
    		$query->set('posts_per_page', '-1');
    	}
    	return $query;
    }
    add_action('pre_get_posts','sc_pre_get_posts');
    
Viewing 1 replies (of 1 total)
  • The topic ‘Query Custom Post Types to Reorder Page’ is closed to new replies.