• Resolved zupergeorge

    (@zupergeorge)


    We use the Web 2.0 Directory Plugin in our wordpress site to display a business directory. The plugin has it’s own sorting options whitch are somehow overwritten when the Post Types Order Plugin is active.

    I manualy solved it by modifying the posts_orderby function inside the \include\class.cpto.php file, adding the lines:

     //ignore the w2dc
     if (isset($query->query_vars['post_type']) == "w2dc_listing")
           return $orderBy;

    As this fix will require me to re-add the above lines every time the Post Types Order Plugin is updated, can you suggest a more elegant solution?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Maya

    (@tdgu)

    Hi,
    Actually there’s no need to hack the code, you can rely on the filter pto/posts_orderby/ignore

    e.g.

    add_filter( 'pto/posts_orderby/ignore', pto_posts_orderby_ignore, 10, 3);
        function pto_posts_orderby_ignore($ignore,  $orderBy, $query)
            {
                if (isset($query->query_vars['post_type']) == "w2dc_listing")
                    $ignore =   TRUE;
                    
                return $ignore;  
                
            }

    Thanks

    Plugin Author Maya

    (@tdgu)

    An update for above code:

    add_filter( 'pto/posts_orderby/ignore', pto_posts_orderby_ignore, 10, 3);
        function pto_posts_orderby_ignore($ignore,  $orderBy, $query)
            {
                if (isset($query->query_vars['post_type']) &&  $query->query_vars['post_type'] == "w2dc_listing")
                    $ignore =   TRUE;
                    
                return $ignore;  
                
            }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Sorting Problem with the Web 2.0 Directory Plugin’ is closed to new replies.