Better way to enforce category hierarchy in post_categories_metabox?
There’s a plugin written specifically to fix this ‘feature’ of WordPress, it’s called Category Checklist Tree. Despite the name, it works on custom taxonomies too.
There’s a plugin written specifically to fix this ‘feature’ of WordPress, it’s called Category Checklist Tree. Despite the name, it works on custom taxonomies too.
I battled to create hierarchical for post types and custom taxonomies and then found this great code, maybe you can use it to make a date based sctructure: https://wordpress.stackexchange.com/a/55366/17048
The challenge we try to take on here is how to: not remove or replace the current Page Attribute meta box keep the hierarchical information in the drop-down. We assume we’re on the single page edit screen, and want to add the event post type to the page parent drop-down. The drop-down is displayed using … Read more
Yes, this capability is available with register_post_type, via the show_in_menu argument, but whether or not the particular plugin you are using supports this I don’t know. add_action( ‘init’, ‘wpa70679_custom_types’ ); function wpa70679_custom_types() { register_post_type( ‘parent_type’, array( ‘public’ => true, ‘labels’ => array( ‘name’ => ‘Parent post type’ ) ) ); register_post_type( ‘child_type’, array( ‘public’ => … Read more
<?php $args = array( ‘taxonomy’ => ‘product-type’, ‘hierarchical’ => true, ‘title_li’ => ”, ‘hide_empty’ => false ); ?> <ul> <?php wp_list_categories( $args ); ?> </ul> You can use the wp_list_categories function also for taxonomies. http://codex.wordpress.org/Template_Tags/wp_list_categories
The template hierarchy has filters for all types of templates. Here we can use category_template, check if the current category has a parent, and load the subcategory.php file in that case: function wpd_subcategory_template( $template ) { $cat = get_queried_object(); if ( isset( $cat ) && $cat->category_parent ) { $template = locate_template( ‘subcategory.php’ ); } return … Read more
This may not help any, but it can’t hurt to try it… Log into your server admin area, invoke the client interface for your database administration (e.g. phpMyAdmin), delete all the posts where their ‘type’ is marked as a revision, then compact the table. If you have thousands of pages, you might also have millions … Read more
When planning more complex WordPress sites, I try to think of the page/url hierarchy in terms of the default WordPress Database Schema. Then determine the best URL rewrite scheme and data structure. Very generally, I find that data objects most important to the user should exist as a custom post type or a post object, … Read more
The best way would be to use wp_nav_menu with a custom walker. Prerequisites: Registered theme location Menu saved to that theme location Useage Wherever you want the breadcrumbs (for theme location ‘primary’): <?php wp_nav_menu( array( ‘container’ => ‘none’, ‘theme_location’ => ‘primary’, ‘walker’=> new SH_BreadCrumbWalker, ‘items_wrap’ => ‘<div id=”breadcrumb-%1$s” class=”%2$s”>%3$s</div>’ ) ); ?> The custom walker … Read more
WordPress uses a set of rewrite rules to be able to convert an url into a database query. The regex that handle urls for pages is very general, IIRC it is something like (.+.?)/?, it mathes pratically everything has not be already matched by other rules. For this reason is not possible to write a … Read more