Pages, Custom Posts & Custom Taxonomy defining slug structure

All of the cases you describe are handled by the post type archive, post type single, and taxonomy term archive pages that are all automatically generated (depending on arguments) when you register your post type and taxonomy. function wpd_add_custom_types() { // register fruit post type $args = array( ‘public’ => true, ‘label’ => ‘Fruit’, ‘has_archive’ … Read more

Taxonomy query for children of parents

Use get_queried_object() to get the current queried term on a category page: $this_term = get_queried_object(); $args = array( ‘parent’ => $this_term->term_id, ‘orderby’ => ‘slug’, ‘hide_empty’ => false ); $child_terms = get_terms( $this_term->taxonomy, $args ); echo ‘<ul>’; foreach ($child_terms as $term) { echo ‘<li><h3><a href=”‘ . get_term_link( $term->name, $this_term->taxonomy ) . ‘”>’ . $term->name . ‘</h3></a></li>’; … Read more

Need help with complex custom post type setup

Ok, that is complicated 🙂 Have you considered using rewrite endpoints? I would not try and cram everything into the url unless you have a specific need or a requirement for that. domain/<series>/<episode-name> would be going directly to the episode CPT domain/cartoon-series/<series> – would go the the series CPT Then using rewrite endpoints to have … Read more

Help With issue on pre_get_posts filter in taxonomy

Solved! I was using the wrong technique to create a custom query to my taxonomy instead of using the function above I create new function that use query_vars. Here is the code function taxonomy_posts_order($query) { global $browsetype; $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); if ( $query->query_vars[‘taxonomy’] == $term->slug ) { … Read more