taxonomy-terms-order
Last commit date
css
2 weeks ago
images
2 weeks ago
include
2 weeks ago
js
2 weeks ago
languages
2 weeks ago
composer.json
2 weeks ago
readme.txt
2 weeks ago
screenshot-1.png
2 weeks ago
screenshot-2.png
2 weeks ago
taxonomy-terms-order.php
2 weeks ago
taxonomy-terms-order.php
97 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Plugin Name: Category Order and Taxonomy Terms Order |
| 4 | * Plugin URI: http://www.nsp-code.com |
| 5 | * Description: Order Categories and all custom taxonomies terms (hierarchically) and child terms using a Drag and Drop Sortable javascript capability. |
| 6 | * Version: 1.9.9.1 |
| 7 | * Author: Nsp-Code |
| 8 | * Author URI: https://www.nsp-code.com |
| 9 | * Author Email: contact@nsp-code.com |
| 10 | * Text Domain: taxonomy-terms-order |
| 11 | * Domain Path: /languages/ |
| 12 | */ |
| 13 | |
| 14 | |
| 15 | define('TOPATH', plugin_dir_path(__FILE__)); |
| 16 | define('TOURL', plugins_url('', __FILE__)); |
| 17 | |
| 18 | define('TTO_VERSION', '1.9.9.1'); |
| 19 | |
| 20 | include_once ( TOPATH . '/include/class.tto.php' ); |
| 21 | include_once ( TOPATH . '/include/class.functions.php' ); |
| 22 | include_once ( TOPATH . '/include/class.addons.php' ); |
| 23 | include_once ( TOPATH . '/include/class.compatability.php' ); |
| 24 | |
| 25 | register_activation_hook(__FILE__, 'TTO_activated'); |
| 26 | function TTO_activated( $network_wide ) |
| 27 | { |
| 28 | global $wpdb; |
| 29 | |
| 30 | // check if it is a network activation |
| 31 | if ( $network_wide ) |
| 32 | { |
| 33 | // Get all blog ids |
| 34 | $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
| 35 | foreach ( $blogids as $blog_id ) |
| 36 | { |
| 37 | switch_to_blog( $blog_id ); |
| 38 | TTO_functions::check_table_column(); |
| 39 | restore_current_blog(); |
| 40 | } |
| 41 | |
| 42 | return; |
| 43 | } |
| 44 | else |
| 45 | TTO_functions::check_table_column(); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | add_action( 'wp_initialize_site', 'TTO_wp_initialize_site', 99, 2 ); |
| 50 | function TTO_wp_initialize_site( $blog_data, $args ) |
| 51 | { |
| 52 | global $wpdb; |
| 53 | |
| 54 | if ( is_plugin_active_for_network('taxonomy-terms-order/taxonomy-terms-order.php') ) |
| 55 | { |
| 56 | switch_to_blog( $blog_data->blog_id ); |
| 57 | TTO_functions::check_table_column(); |
| 58 | restore_current_blog(); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Load the textdomain |
| 65 | */ |
| 66 | add_action( 'plugins_loaded', 'TTO_load_textdomain'); |
| 67 | function TTO_load_textdomain() |
| 68 | { |
| 69 | load_plugin_textdomain('taxonomy-terms-order', false, dirname( plugin_basename( __FILE__ ) ) . '/languages'); |
| 70 | } |
| 71 | |
| 72 | |
| 73 | /** |
| 74 | * Initialize the main class |
| 75 | * |
| 76 | */ |
| 77 | function TTO_class_load() |
| 78 | { |
| 79 | new TTO(); |
| 80 | } |
| 81 | add_action( 'plugins_loaded', 'TTO_class_load'); |
| 82 | |
| 83 | |
| 84 | /** |
| 85 | * Temporary placeholder function to prevent fatal errors when using the Uncode theme. |
| 86 | * |
| 87 | * @param mixed $clauses |
| 88 | * @param mixed $taxonomies |
| 89 | * @param mixed $args |
| 90 | */ |
| 91 | function TO_apply_order_filter( $clauses, $taxonomies, $args ) |
| 92 | { |
| 93 | return $clauses; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | ?> |