Modify main loop query for paged and meta key

I think this will do what you want. But I still wonder whether sticky posts wouldn’t have been better… if (is_home() && $paged == ‘0’) { //$paged value is 0 on 1st page and not 1 ! query_posts(‘posts_per_page=7&paged=’.$paged.’&meta_key=_pull_leading3&meta_value=off’); } else { // recreate the home page “loop” to figure out which posts to exclude $excluded … 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

How to get any type posts include attachments by ids?

‘post_type’=>’any’ should get you all types except revisions so you should get the attachments but if you don’t try: query_posts( array( ‘posts_per_page’ => -1, ‘ignore_stickies’ => 1, ‘post_type’=> array( ‘post’, ‘page’, ‘attachment’ ), ‘post_status’ => array( null ), ‘post__in’=> $id_list ) ); Update As t31os pointed out that: Attachments don’t have a publish status, which … Read more

Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array

Here’s the code that finally worked for me: <?php global $events_meta_termine; $today = getdate(); $my_query = new WP_Query(‘post_type=events&posts_per_page=-1&monthnum=’.$today[“mon”]); $events=array(); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $meta = get_post_meta(get_the_ID(), $events_meta_termine->get_the_id(), TRUE); foreach ($meta[‘termin_group’] as $termin) { $event=array(); $event[‘title’]=get_the_title(); $event[‘date’]=$termin[‘termin_date’]; $event[‘time’]=$termin[‘termin_time’]; $event[‘location’]=$termin[‘termin_location’]; $events[]=$event; } endwhile; wp_reset_query(); $i=0; usort($events, “cmp”); function cmp($a, $b){ return strcmp($a[‘date’],$b[‘date’]); } ?> … Read more

get parent fields title, content excerpt etc

You can try get_post($post->post_parent) or get_page($post->post_parent) so if you do: $parent = get_post($post->post_parent); You can get the title like this: $parent->post_title; And anything you want, you can var_dump($parent) to see all the post info you can use.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)