Rewriting the WP Sub Posts plugin to allow one custom post type to be a child of another custom post type

Haven’t tried this, but if you look at the code, there’s a query where the posts are retrieved from the database: $query = “SELECT * FROM $wpdb->posts $join WHERE (post_type=”post” AND post_status=”publish”) $where “; As you can see, it’s looking for post_type=”post”. So this will only get the default ‘post’ type posts. You can modify … Read more

Why can’t I query more than 1 post type at a time?

Hi @Bundarr: Testing the following basic example as a standalone file it looks like it works as expected and not as you are reporting: <?php include ‘../wp-load.php’; header(‘Content-type: text/plain’); $q = new WP_Query(array( ‘post_type’=>array(‘publications’, ‘page’) ‘posts_per_page’ => -1, )); echo “SQL: {$q->request}\n”; foreach($q->posts as $post) { echo “{$post->post_name} – {$post->post_type}\n”; } So, I can only … Read more

Letting the user define the arguments in a custom loop? (the “$custom_posts->query(…)” part)

the easiest way would be to create a simple form : <?php $nonce= wp_create_nonce (‘my-nonce’); ?> <form name=”user-query” method=”post”> <input type=”hidden” name=”_wpnonce” id=”_wpnonce” value=”<?php echo $nonce; ?>”/> <p>Locations: <select name=”location” id”location”> <option value=”location1″>location1</option> <option value=”location2″>location2</option> <option value=”location3″>location3</option> <option value=”location4″>location4</option> </select></p> <p>Sections: <select name=”section” id”location”> <option value=”section1″>section1</option> <option value=”section2″>section2</option> <option value=”section3″>section3</option> <option value=”section4″>section4</option> </select></p> <input type=”submit” … Read more

Display latest post of taxonomy

You can do a straight query for the taxonomy term: query_posts( array( ‘review’ => ‘movie’ ) ); To query multiple terms you can use tax_query: ‘tax_query’ => array( ‘taxonomy’ => ‘review’, ‘field’ => ‘slug’, ‘terms’ => array( ‘movie’, ‘term’, ‘term’ ), ),