Giter Site home page Giter Site logo

Comments (5)

razvanaldea89 avatar razvanaldea89 commented on September 25, 2024

Tested with Twenty Nineteen, Twenty Twenty and Twenty Seventeen themes and works. Did the custom posts types and taxonomies the user suggested but again, the order works on archive.php and taxonomy-region.php .

Also, checking the “Show advanced view of Post Types” will show other hidden post types/taxonomies ( see screenshot bellow ) in the lists.

Option toggled off :
Screenshot_2020-04-21 SCPOrder ‹ Colorlib plugins — WordPress

Option toggled on:
Screenshot_2020-04-21 SCPOrder ‹ Colorlib plugins — WordPress(1)

In 2nd screen blocks post can be seen while in the first screen is not there.

from simple-custom-post-order.

JoshuaCrewe avatar JoshuaCrewe commented on September 25, 2024

Just so I can write it somewhere, I found this issue through https://wordpress.org/support/topic/order-not-working-on-taxonomy-archive/.

I was experiencing the same issue that the OP there was.

I tried deactivating some plugins, including this one. When I turned them back on again I got an error from this plugin :

[30-Apr-2020 16:13:10 UTC] PHP Notice:  Trying to get property 'cnt' of non-object in /var/www/project/public/content/plugins/simple-custom-post-order/simple-custom-post-order.php on line 279
[30-Apr-2020 16:13:10 UTC] WordPress database error Unknown column 'term_order' in 'field list' for query
                    SELECT count(*) as cnt, max(term_order) as max, min(term_order) as min
                    FROM vpwp_terms AS terms
                    INNER JOIN vpwp_term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
                    WHERE term_taxonomy.taxonomy = 'department'
                 made by do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, SCPO_Engine->refresh
[30-Apr-2020 16:13:10 UTC] PHP Notice:  Undefined offset: 0 in /var/www/project/public/content/plugins/simple-custom-post-order/simple-custom-post-order.php on line 279

I went to the plugin settings, turned everything off. Then turned on the CPT I was using it for. The error has gone away but it still isn't ordering on category pages.

I can force it to using the pre_get_posts work around :

function custom_pre_get_posts($wp_query) {
    if (($wp_query->is_main_query()) && (is_tax([ ... taxonomies ... ]))) {
        $wp_query->set('orderby', 'menu_order');
        $wp_query->set('order', 'ASC');
    }
}

add_action('pre_get_posts', 'custom_pre_get_posts');

Maybe this is enough :)

from simple-custom-post-order.

Blindeman avatar Blindeman commented on September 25, 2024

I'm having the same problem as OP. With theme twenty twenty-one and only the plugin that adds the CPT and custom taxonomy enabled, plus SCPO of course, I can change the sort order on the back end and the new order shows on the CPT archive but not on the tax archive.
The problem is on the live site and on the development version of the site, which is on a different server.
I can only think of two things:

  1. this is an older site, it's been through some things :) Could there be something in the db?
  2. Do either the custom taxonomy or the CPT require specific arguments? I'm using this plugin.
    I've tried a few different things but I'm stuck, I have no idea.

from simple-custom-post-order.

mplusb avatar mplusb commented on September 25, 2024

another user having the same issue:
https://wordpress.org/support/topic/doesnt-work-on-custom-post-type-categories/

from simple-custom-post-order.

codeflorist avatar codeflorist commented on September 25, 2024

the solution by JoshuaCrewe was not working for me. here is what worked for me:

add_filter('posts_orderby', function ($orderby, $query) {
	if (is_admin() || !$query->is_main_query() || !is_tax([ ... taxonomies ... ])) {
		return $orderby;
	}
	return 'wp_posts.menu_order ASC';
}, 10, 2);

from simple-custom-post-order.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.