Articles of children

How to create drop down for child categories of current taxonomy being viewed?

I need to know how can I get the child/grandchild terms of the current taxonomy being viewed, and put it into a drop down so that I can add values to the options. I am currently using this code to display exactly what I want, but I am unable to modify the options in the […]

get_term_children returns WP_Error for custom taxonomy

What I’m working on is a ajax based dropdown option form which returns child terms based on the option selected. When the option is selected, a function is fired using onchange, where the script grabs the term_id and taxonomy of the selected option, and sends both of those to the server. The server side script […]

Show only first children level of current category?

I wish to display only first level of subcategories on current category page (if any). I tried this code: <?php $args=array( ‘child_of’ => $cat-id, ‘hide_empty’ => 0, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘depth’ => ‘1’ //NOT WORKING ); $categories=get_categories($args); foreach($categories as $category) { echo ‘<a href=”‘ . get_category_link( $category->term_id ) . ‘” title=”‘ . […]

Display Categories or Subcategories with name & description in category.php

I have the following issue for my customer. Can some suggest a possible solution to this issue? This website has Categories & Subcategories Cat1 -Subcat1 -Subcat2 -Subcat3 Cat2 -Subcat1 -Subcat2 -Subcat3 WHAT I NEED IS: When I click on Cat1 or Cat2, I need to display something like that: Repeat this action as long the […]

Delete Child Posts

I’m trying to delete all child posts when the parent is deleted. The parent post deletes just fine, but the child posts are not properly deleting. Here’s the code I have in place now: $args = array( ‘post_parent’ => $parentid, ‘post_type’ => ‘custom-type’ ); $posts = get_posts( $args ); if ($posts) { // Delete all […]

get_children() not working properly – Only on one post?

Client wants to show how many images await the reader in a post. I say: easy peazy. Now I realize: I lied. The system only uses galleries, even for single pictures. $images = get_children(array( “post_parent” => $post->ID, // $post->ID gives the right ID. “post_status” => “any”, “post_type” => “attachment”, “post_mime_type” => “image” )); count($images); // […]

Check if post has children or not

I need some code to know if the post has another pages or not unfortunately i didn’t find yet now any reference for this so any idea will be appreciated What I need to acheive is if has child //some staff else: // another staff now I am using $args = array( ‘post_parent’ => get_the_ID(), […]

How to get the excerpts of all children pages

I’m currently trying to get this working: I want to display a list of excerpts of all children pages within my parent site. According to the WP Codex this ist possible through ‘get_pages’ function and the key ‘page_excerpt’. This is my approach: <?php $pagechildren = get_pages( array( ‘child_of’ => $post->ID ) ); ?> <?php foreach […]

How to get the top most term (top ancestor) of a custom taxonomy child term?

I need to get the topmost term (top level ancestor) of a taxonomy term. Suppose the following term hierarchy: North America United States New York New York City South America Mexico I need to get the ID of “North America” term if I know the ID of “New York” I’m using an adapted function found […]

Get threaded comments number

I’m using Greg’s Threaded Comment Numbering plugin to number the comments. Actually I’m displaying a number beside of each parent comment (no threaded comments numbers). I have 2 problems that I have already tried to solve, but without results: I am displaying the top comment with a different layout, I need to start the numbering […]