How do you Query posts with nothing in common?

Maybe you’re looking for the post__in parameter in WP_Query. $query = new WP_Query(array( ‘post__in’ => array(23,18,2,199,6,8) ); And then: while ( $query->have_posts() ) { $query->the_post(); /* post loop */ } Take a look at the docs. =D For public queries: post__in is not public queryable by default, so you can just validate and copy $_GET[‘post__in’] … Read more

Change gravity forms confirmation redirect query string to include entry id [closed]

I figured it out. I did have some syntax errors in my code. Should have been add_filter instead of add_action. Also, $confirmation is an array and was never returned. I think my brain was just tired from looking at this for so long. Anyways, here’s what I did to fix it. add_filter(“gform_confirmation”, “confirm_change”, 10, 4); … Read more

Count number of published posts by type

If you prefer the $wpdb direct queries you can use something like this: global $wpdb; $count = $wpdb->get_var( “SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_type=”code” and post_status=”publish”” ); echo $count; In the sql query above change the post_type to whatever you like. This will return count of published posts under specific post type only. If you … Read more

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