pageManagement [WP_Admin > Manage > pageMash] Author: Joel Starnes Version: 1.0.1 Author URI: http://joelstarnes.co.uk/ CHANGELOG: Release: Date: Description: 0.1.0 10 Feb 2008 Initial release 0.1.1 12 Feb 2008 Minor fixes > Removed external include 0.1.2 15 Feb 2008 Minor fixes > Fixed CSS&JS headers to only display on pagemash 1.0.0 beta 19 Feb 2008 Major update > Recusive page handles unlimited nested children, collapsable list items, interface makeover... 1.0.1 beta 14 Mar 2008 fixed IE > drag selects text FIXME: @fixme with instantUpdateFeature hide will not send the update */ #########CONFIG OPTIONS############################################ $minlevel = 7; /*[deafult=7]*/ /* Minimum user level to access page order */ $excludePagesFeature = false; /*[deafult=true]*/ /* Allows you to set pages not to be listed Will only work if you have modified the template. */ $instantUpdateFeature = false; /*[deafult=false]*/ /* Updates the database instantly after a move using ajax otherwise it will wait for update button press. nb. this feature has not been optimised and enabling will cause much increased server load */ ################################################################### /* CREDITS: Valerio Proietti - Mootools JS Framework [http://mootools.net/] Stefan Lange-Hegermann - Mootools AJAX timeout class extension [http://www.blackmac.de/archives/44-Mootools-AJAX-timeout.html] vladimir - Mootools Sortables class extension [http://vladimir.akilles.cl/scripts/sortables/] ShiftThis - WP Page Order Plugin [http://www.shiftthis.net/wordpress-order-pages-plugin/] */ /* Copyright 2008 Joel Starnes (email : joel@joelstarnes.co.uk) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ function pageMash_getPages($post_parent){ //this is a recurrsive function which calls itself to produce a nested list of elements //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages global $wpdb, $wp_version, $instantUpdateFeature, $excludePagesFeature, $excludePagesList; if($wp_version >= 2.1){ //get pages from database $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order"); }else{ $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' AND post_parent = '$post_parent' ORDER BY menu_order"); } if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them. echo '
Just drag the pages up or down to change the page order and left or right to change the page's parent, then hit 'update'.
The icon to the left of each page shows if it has child pages, double click anywhere on that item to toggle expand|collapse of it's children.
In most cases, to use this plugin you will not need to change anything, however if its not working you will need to either:
Code:
<?php if(function_exists('pageMash_exclude_pages')){$exclude_pages=pageMash_exclude_pages();} else{$exclude_pages='';}?>
<?php wp_list_pages('title_li=<h2>Pages</h2>&exclude='.$exclude_pages);?>
The plugin code is very simple and flexible, for more information look at the wp_list_pages() function on the Wordpress Codex and if you have any further questions or feedback, just drop me an email.