mateuszkalamarz
Forum Replies Created
-
Oh, there is an “Order” submenu. I’m so blind, sorry for that and thank you for resolving my issue ??
Thank you for a precise explanation. I’ve checked “Post Attributes” for my CPT and now it shows.
Maybe you would consider adding a short description next to the setting? I guess an exclamation icon with tooltip would cool.
Just to make sure, they shouldn’t be draggable on the CPT’s list on backend?
Forum: Plugins
In reply to: [Custom Taxonomy Order] Disabling/Enabling for chosen taxonomiesThank you for this new filter and the code, and especially for pushing a new version right away!
To sum it up for others possibly reading this.
The code provided by Marcel leaves in the plugin menu (and it sub-views) only those taxonomies that were already ordered using this plugin. This is why he states
Please be aware that if you want the settings for ordering changed, you need to disable this filter again.
What I wanted to achieve, was to leave in the menu only specific taxonomies, so only they can ever get ordered. This shouldn’t require them to be already ordered by this plugin. So based on the code provided by Marcel I have simply used.
function define_orderable_taxonomies( $taxonomies ) { if ( ! is_admin() ) { return $taxonomies; } // Get the settings fresh, without filter, that would get an endless loop of filtering. $defaults = array('category' => 0); $defaults = apply_filters( 'customtaxorder_defaults', $defaults ); $settings = get_option( 'customtaxorder_settings' ); $settings = wp_parse_args( $settings, $defaults ); $new_taxonomies = array(); // Define an array of names of the taxonomies that should be possible to be ordered by plugin $new_taxonomies_names = array( "taxonomy_name1", "taxonomy_name2" ); foreach ( $taxonomies as $taxonomy ) { // Get the taxonomy name $taxonomy_name = $taxonomy->name; // Check if name is in the array if ( in_array($taxonomy_name, $new_taxonomies_names) ) { // Add only selected taxonomies to the array $new_taxonomies[] = $taxonomy; } } return $new_taxonomies; } add_filter( 'customtaxorder_get_taxonomies', 'define_orderable_taxonomies' );
I gave this function a new name, so it won’t get confusing.