Changeset 822687
- Timestamp:
- 12/15/2013 09:11:37 PM (12 years ago)
- Location:
- pages-children/trunk
- Files:
-
- 2 edited
-
pages-children.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages-children/trunk/pages-children.php
r514077 r822687 5 5 Description: Display hierarchical post types and taxonomies a single level pages at a time. 6 6 Author: Paul Menard 7 Version: 1.5.2 7 Version: 1.5.2.1 8 8 Author URI: http://www.codehooligans.com 9 9 */ … … 15 15 var $post_type_object; 16 16 17 function PagesChildren() {17 function __construct() { 18 18 19 19 $this->object_post_taxonomy = null; 20 20 $this->terms_args_cnt = 0; 21 22 if (!defined('PAGES_CHILDREN_TAXONOMY')) 23 define('PAGES_CHILDREN_TAXONOMY', 3); 21 24 22 25 add_action( 'init', array(&$this, 'init' )); … … 28 31 } 29 32 33 function PagesChildren() { 34 $this->__construct(); 35 } 36 30 37 function init() { 31 38 $plugin_dir = basename(dirname(__FILE__))."/lang"; … … 47 54 } 48 55 $this->filter_admin_menu(); 49 56 50 57 if (isset($_GET['post_type'])) 51 58 $this->object_post_taxonomy = get_post_type_object($_GET['post_type']); … … 84 91 if (!isset($qs_vars['order'])) 85 92 $qs_vars['order'] = 'asc'; 86 93 94 $qs = ''; 87 95 foreach($qs_vars as $qs_idx => $qs_val) 88 96 { … … 372 380 function get_terms_args_filter($args, $taxonomies) 373 381 { 374 if (($this->check_uri('wp-admin/edit-tags.php')) && ( isset($_GET['taxonomy'])) && (is_taxonomy_hierarchical($_GET['taxonomy']))) 375 { 376 if ((isset($_GET['action'])) && ($_GET['action'] == "edit")) return $args; 377 378 $this->terms_args_cnt += 1; 379 #1 the table pager 380 #2 the table listing itself 381 #3 the dropdown on the entry form. 382 if ($this->terms_args_cnt > 2) 383 { 384 // echo "terms_args_cnt=[". $this->terms_args_cnt ."]<br />"; 385 // echo "args<pre>"; print_r($args); echo "</pre>"; 386 return $args; 387 } 388 389 $parent_id = 0; 390 391 if (isset($_GET['parent'])) 392 $parent_id = intval($_GET['parent']); 393 else if (isset($_COOKIE['pages-children-'. $_GET['taxonomy'] .'-parent-id'])) 394 $parent_id = intval($_COOKIE['pages-children-'. $_GET['taxonomy'] .'-parent-id']); 395 396 remove_filter('get_terms_args', array($this, 'get_terms_args_filter'), 10, 2); 397 398 $terms_args = array( 399 'hide_empty' => 0, 400 'hierarchical' => 1, 401 'parent' => $parent_id, 402 'child_of' => $parent_id 403 ); 404 405 $child_terms = get_terms( $_GET['taxonomy'], $terms_args); 406 407 add_filter('get_terms_args', array($this, 'get_terms_args_filter'), 10, 2); 408 if ($child_terms) 409 { 410 $args['hide_empty'] = 0; 411 $args['parent'] = $parent_id; 412 $args['child_of'] = $parent_id; 413 $args['hierarchical'] = 1; 414 } 382 //if (($this->check_uri('wp-admin/edit-tags.php')) && ( isset($_GET['taxonomy'])) && (is_taxonomy_hierarchical($_GET['taxonomy']))) 383 if (!$this->check_uri('wp-admin/edit-tags.php')) 384 return $args; 385 386 if ( !isset($_GET['taxonomy'])) 387 return $args; 388 389 if (!is_taxonomy_hierarchical($_GET['taxonomy'])) 390 return args; 391 392 if ((isset($_GET['action'])) && ($_GET['action'] == "edit")) return $args; 393 394 // Check if there is a defin for this taxonomy. 395 if (!defined('PAGES_CHILDREN_TAXONOMY_'. strtoupper($_GET['taxonomy']))) { 396 // If not use the default 'PAGES_CHILDREN_TAXONOMY' define (3) 397 define('PAGES_CHILDREN_TAXONOMY_'. strtoupper($_GET['taxonomy']), PAGES_CHILDREN_TAXONOMY); 398 } 399 $taxonomy_counter = constant('PAGES_CHILDREN_TAXONOMY_'. strtoupper($_GET['taxonomy'])); 400 401 $this->terms_args_cnt += 1; 402 403 if ($this->terms_args_cnt != $taxonomy_counter) 404 return $args; 405 406 $parent_id = 0; 407 408 if (isset($_GET['parent'])) 409 $parent_id = intval($_GET['parent']); 410 else if (isset($_COOKIE['pages-children-'. $_GET['taxonomy'] .'-parent-id'])) 411 $parent_id = intval($_COOKIE['pages-children-'. $_GET['taxonomy'] .'-parent-id']); 412 413 remove_filter('get_terms_args', array($this, 'get_terms_args_filter'), 10, 2); 414 415 $terms_args = array( 416 'hide_empty' => 0, 417 'hierarchical' => 1, 418 'parent' => $parent_id, 419 'child_of' => $parent_id 420 ); 421 422 $child_terms = get_terms( $_GET['taxonomy'], $terms_args); 423 424 add_filter('get_terms_args', array($this, 'get_terms_args_filter'), 10, 2); 425 if ($child_terms) 426 { 427 $args['hide_empty'] = 0; 428 $args['parent'] = $parent_id; 429 $args['child_of'] = $parent_id; 430 $args['hierarchical'] = 1; 415 431 } 416 432 return $args; -
pages-children/trunk/readme.txt
r514077 r822687 3 3 Donate link: http://www.codehooligans.com/donations/ 4 4 Tags: pages, post types, taxonomies, page management, edit, display, hierarchical 5 Requires at least: 3. 1.36 Tested up to: 3. 3.17 Stable tag: 1.5.2 5 Requires at least: 3.7 6 Tested up to: 3.8 7 Stable tag: 1.5.2.1 8 8 9 9 == Description == … … 53 53 == Changelog == 54 54 55 = 1.5.2.1 = 56 * 2013-12-15: 57 * Minor bug. Fixed issue with taxonomy nested items not working on 3.7 and newer. Thanks Euan! 58 * Also checked UI functionality for WP 3.8. 59 55 60 = 1.5.2 = 56 * 2012-03-03: Minor bug fixes when mixed Published and Draft Pages. The bug prevented getting down to or moving up the hierarchy if the child or parent were in draft status.61 * 2012-03-03: Minor bug fixes when mixed Published and Draft Pages. The bug prevented getting down to or moving up the hierarchy if the child or parent were in draft status. 57 62 58 63 = 1.5.1 =
Note: See TracChangeset
for help on using the changeset viewer.