How to include child terms within parent?
How to include child terms within parent?
How to include child terms within parent?
list first post of Child Category on Category page
When i lost track with all the crappy code, i decided to start all over 🙂 And so i found the solution: <?php // Define variables $post_type=”file”; $taxonomy = ‘file-category’; $taxonomy_terms = get_terms($taxonomy); global $current_page_id; $current_page_id = get_the_ID(); // Start if if ($taxonomy_terms) { // Start Foreach foreach ($taxonomy_terms as $taxonomy_term) { // Start arguments … Read more
If I were doing a site such as you describe, I would probably make a Custom Post Type for “Artists”, another Custom Post Type for “Albums”, and would link them with the “Posts 2 Posts” plugin. It’s easy to use and well documented. That way, you can later easily attach images and galleries, mp3s, and … Read more
I solved by force refreshing the cache (by @passatgt). i.e., place this line after the insertion: delete_option(“{$taxonomy}_children”); Thanks!
Based on my subsequent review of wp-includes/query.php, what I was attempting is simply not possible. This is because the query vars may only be modified to predefined set of values. As best I can determine, you cannot arbitrarily modify queries.
solution here as function: function testchildren () { global $post; $childtest = get_pages(‘child_of=”.$post->ID); if( count( $childtest ) != 0 ) { return false; } else { return true; } } and implementation as markup: <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2> <?php if ( … Read more
I’ve figured this out. I think one of the examples in the WordPress Codex is supposed to be the solution but simply doesn’t work. Here is what worked for me: <?php if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID); $root=count($ancestors)-1; $parent = $ancestors[$root]; } else { $parent = $post->ID; } $children = wp_list_pages(“title_li=&child_of=”. $parent .”&echo=0″); if ($children) { ?> … Read more
Automatically add another subpost of the same parent when a subpost is saved
To expand upon my comment: Top-level page? (q.1) global $post; $x = get_ancestors( $post->ID, ‘page’ ); if( ! $x ) { // there are no ancestors, therefore this is a top-level page } Childless page? (q.2) global $post; $args = array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ); $x = get_children( $args ); if( ! … Read more