Sort get_pages by custom field
-
I’m trying list child pages and some custom field values, and have them print sorted by one of those custom field values.
At the moment I have this:
<?php $children = get_pages('child_of=' . $post->ID); if (!empty($children)) { foreach($children as $child) { $tittel = get_the_title($child->ID); $dato = get_post_meta($child->ID, 'dato', true); $regiss?r= get_post_meta($child->ID, 'regiss?r', true); $nasjonalitet= get_post_meta($child->ID, 'nasjonalitet', true); $produksjons?r= get_post_meta($child->ID, 'produksjons?r', true); $klokkeslett= get_post_meta($child->ID, 'klokkeslett', true); $url= get_permalink($child->ID); echo '<p><strong>' . strtoupper(date("l, j. F", strtotime($dato))) . ', KL. ' . $klokkeslett . '</strong><br>'; echo '<a href="' . $url . '">' . strtoupper($tittel) . '</a>'; if (!empty($regiss?r)) { echo ' – ' . $regiss?r . ', ' . $nasjonalitet . ', ' . $produksjons?r . '</p>';} } } ?>
At the moment, the list is just like I want it, except that the pages are not sorted by the custom field ‘dato’, which is what I’d like to do.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Sort get_pages by custom field’ is closed to new replies.