MattParkins
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Maximum password lengthNo, unfortunately not!
Forum: Plugins
In reply to: Get current page ID (NOT post ID)Thanks for that, Rick, that helps me grasp what is going on.
Unfortunately the_ID() did not work for me presumably because I wasn’t inside the loop, but in a single page. In fact the_ID() killed execution.
Forum: Plugins
In reply to: Get current page ID (NOT post ID)Solved. I hate wordpress.
The solution was to use $post->ID as above, except IT NEEDS A global $post; first. Seriously, where is that in the docs?
<?php echo “pageid: “.$post->ID; ?> // DOES NOT WORK
<?php global $post; echo "pageid: ".$post->ID; ?>
It is probably related to some php.ini setting, or PHP5 or something, but some kind of warning somewhere would have been nice.
Forum: Plugins
In reply to: My Page Order Plugin Doesn’t Work!Initially this plugin didn’t work for me either but I worked out why and have been able to fix it. Please bear in mind that if the plugin isn’t working for you it is not the fault of the author of the plugin, but the author of the theme that you are using. The theme I was using (Primepress, specifically header.php) implements its own way of getting a list of pages by talking to the database directly rather than going through the correct functions – it bypasses the sorting functions.
I fixed the problem by finding where in the theme (use the theme editor) it makes the database call (probably in the same php file as the data is used) and alter the sql directly from “order by ID” (or by title) to “order by menu_order”. For example, header.php in the Primepress theme I changed the following line from:
$these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" order by ID');
to
$these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" order by menu_order');
Also, if you need page ordering in the side bar widget you need edit the widget and set the “sort by” to “page order”.
Hope that helps. There are some really shoddy themes out there.
Thanks for the widget!