Support » Plugin: Post Types Order » Trying to ignore sort for specific post types

  • Resolved selliott

    (@selliott)


    This plugin is conflicting with Toolset Views, so I’m trying to write a function to ignore Post Type Order on a specific post type. What do I need to adjust on the following code to make this work?

    add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby', 10, 2);
    function theme_pto_posts_orderby($ignore, $orderBy, $query){
    	if(($query->query_vars['post_type'] == 'game') || (is_array($query->query_vars['post_type'][0] == 'game'))){
    		$ignore = true;
    		return $ignore;
    	}
    	return $orderBy;
    }
Viewing 1 replies (of 1 total)
  • Thread Starter selliott

    (@selliott)

    I was able to get this to start working. Here’s the code that’s now working:

    
    add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby_ignore', 10, 3);
    function theme_pto_posts_orderby_ignore($ignore, $orderBy, $query){
    	if (isset($query->query_vars['post_type']) == "game"){
    		$ignore = true;
    		return $ignore;
    	}
    }
    
    • This reply was modified 4 years, 10 months ago by selliott.
Viewing 1 replies (of 1 total)
  • The topic ‘Trying to ignore sort for specific post types’ is closed to new replies.