Display a Custom Post Type within another with hierarchically slug

Base on comment, you need to create a little function to display these related posts. You can do it in different ways, here is an simple example by adding your own action to the template. in your template file place where you want to show related lessons do_action(‘related_lesson’); In functions.php function get_related_lesson(){ global $post; $args … Read more

Different template for subcategories

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

Create a Hierarchical List of Custom Taxonomies AND Posts

I’ve been working on a solution this afternoon and have come up with the following. It may not be the most elegant way of doing this though, so I’m open to further comments. function custom_tax_list_and_posts() { $post_type=”CUSTOM_POST_TYPE_NAME”; $taxonomy = ‘CUSTOM_TAXONOMY_NAME’; // Get all of the parent terms in the custom taxonomy and include empty ones … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)