Sort get_children by menu_order

Following WordPress 3.5, gallery shortcodes now include the image IDs by default. Like this which also holds the order, so open the plugin file named carousel-gallery-jquery.php and replace this line: (around line 140) $attachments = get_children( array(‘post_parent’ => $id, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) ); … Read more

Page to output sub-pages (children)

You can use for example very basic WP Query (or get_pages or what ever. this is just one example) (http://codex.wordpress.org/Class_Reference/WP_Query) // The Query $currentPageId = $post->ID; // get current page id inside loop $args = array( ‘post_parent’ => $currentPageId, ‘post_type’ => ‘page’, ‘posts_per_page’ => -1 ); $query = new WP_Query( $args ); // The Loop … Read more

Is there a way to order children of post?

This should be doable in the get_children() query, try the following: Take a look at the codex entry of get_children(). You will see that get_children() uses the same args as get_posts(). If you than look at get_posts() you will see that you have 2 order arguments to work with: ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, … Read more

Drop-Down Menu of Current Child Pages

This can be approached by using wp_dropdown_pages() with the child_of parameter. global $post; $args = array( ‘child_of’ => $post->ID ); wp_dropdown_pages( $args ); The variable name will be $_GET[‘post_id’] or $_POST[‘post_id’], depending on your form settings, you can change the name by altering the name parameter. The value of the variable is the ID of … Read more

Get gallery images from page ID

You could use the get_post_galleries_images function, which returns an array of all the galleries from whatever post ID you specify. The following is a quick function that will display all the images: function na_get_gallery_image_urls( $post_id, $number = false ) { $post = get_post($post_id); $count = 0; // Make sure the post has a gallery in … Read more

filter get_children to return all mime types EXCEPT ‘x’

Looks like this is two questions: how to get all the children that are audio, and how to get all the children that aren’t audio. 1) The post_mime_type parameter of get_children can actually take a wildcard, so you could use: $children = get_children(array( ‘post_parent’ => $post->ID, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type => ‘audio/%’ … Read more

get_page_children() return only titles

You can just return the IDs, then get each title by the respective ID. And to restrict the query to four posts only, you can use posts_per_page. I modified and optimized your above code a bit, so here it is: <h3>Recent Projects</h3> <ul class=”footer-list”><?php $projects_page = get_page_by_title(‘Projects’); $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => … Read more

Need help with category listing!

I would first put all parent categories into one array – then run through that array and get all child categories and their respective posts. So you could basically build a loop ‘around’ your loop – first loop only queries to a depth of 1 (parent cats) and then the second loop looka a lot like yours, … Read more