Get posts for each user

According to the WP_Query::parse_args docs (which is what parses the $args you’re passing to get_posts()), the $author parameter needs to be an int or a string (a comma-separated list of IDs). But you’re also going to need this set up in groups, per student, so here’s what I’d recommend: use an array to store each … Read more

Help with query_posts function

The query_posts() function is almost wholly unnecessary and is discouraged in favor of WP_Query(). That being said we can look at the WP_Query() docs as they’re almost the same. The cat parameter accepts either a comma separated string or integer. In this case we can use: query_posts( array( ‘cat’ => 1, ‘posts_per_page’ => ‘8’, ‘post__not_in’ … Read more

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

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

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