dancameron
Member
Posted 1 year ago #
I just can't figure this one out.
Is it possible to create a loop of pages? I need to create a "page" that displays sub pages, like a category page would for posts.
Is this even possible? Anyone build a plugin to accomplish this?
I'm not interested in manually querying each post in the template page, it needs to be dynamic.
Thanks in advance.
Use this with a loop in a page template:
$myquery = WP_Query('post_type=page')
dancameron
Member
Posted 1 year ago #
Thanks MichaelH,
I ended up going a different using a custom select query.
<?php
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'repertory'
AND wposts.post_type = 'page'
ORDER BY wpostmeta.meta_value DESC
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>