Articles of get children

WordPress count child posts of each parent custom post type and use in json array for google maps jquery plugin

So i have been looking for a couple of days now and cant find a solution to this anywhere. It is a fairly bespoke request from a client… I am using a jQuery google maps plugin to add markers for each post (area) that the admin creates using a custom meta box with lat and […]

Display post taxonomies tree

I was able to get all the items of a custom taxonomy for a post, like this: $args=array(‘orderby’=>’parent’,”fields” => “all”); $term_list = wp_get_post_terms($post->ID, ‘tvr_amenity’, $args); My problem is that i would like to show the tree (respecting the parents) So i would like to get them ordered by name and parent but i cant find […]

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); // […]

How can I paginate image attachments in a post?

I have a post with attached images and I was able to display the images but I’m can’t seem to find a way to paginate the results. I am using get_children but now I’m wondering if my method of displaying the images is the right way to do it or not. What other methods can […]

How to order get_term_children output by alphabetic order

The following creates drop-down lists of my custom taxonomy children, but the order of the output seems to by creation date, not by alphabetical name. I tried adding orderby to the array with no success. I’ve read about usort but am not sure how to implement it. I’d appreciate any help. $term_id = 61; $taxonomy_name […]

get_term_children for immediate children only (not grandchildren)

I want to display term children of a custom taxonomy. Currently, I am able to do this using get_term_children, but using this, it displays children and grandchildren, I want to avoid this and make that only immediate children are shown. This is what I have right now ( but it outputs children and grandchildren) : […]

Custom Taxonomy: Parent still counting deleted Child

I have this weird situation when I deleted two child taxonomies but they still seem to be assigned to their parent. I need a overview site for all our products with the taxonomy title ahead. If there is a child taxonomy the products should display under the child, and not under the parent taxonomy. the […]

get_children() Not Working with orderby Parameter

I am trying to use the orderby parameter in the get_children function as below: $navigation = get_children(array( ‘post_parent’ => $parent->ID, ‘orderby’ => ‘menu_order’ )); But it is having no effect on the result; it is still ordering by the default creation date. Any ideas?

Child terms from multiple parents?

I’m using isotope to filter a custom post type. But I only want the child taxonomies of 2 particular parents. I have it working nicely for one parent, but I’m not sure how to modify the array to allow for 2 parents. $terms = get_terms(‘speight_plans’, array(‘parent’ => 16)); // you can use any taxonomy, instead […]

Get first image in a post

I am using this code directly from the codex. function echo_first_image ($postID) { $args = array( ‘numberposts’ => 1, ‘order’=> ‘ASC’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $postID, ‘post_status’ => null, ‘post_type’ => ‘attachment’ ); $attachments = get_children( $args ); //print_r($attachments); if ($attachments) { foreach($attachments as $attachment) { $image_attributes = wp_get_attachment_image_src( $attachment->ID, ‘thumbnail’ ) ? wp_get_attachment_image_src( […]