Trying to only display 1 category using get_posts

Did you try the example given in the codex? <?php global $post; $args = array( ‘numberposts’ => $number, ‘category’ => 6, ‘order’ => ‘ASC’, ‘orderby’ => ‘post_date’ ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li><a href=”https://wordpress.stackexchange.com/questions/20091/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endforeach; ?> This a modified version that … Read more

get_posts that haven’t been assigned a specific custom field

You can do it with a posts_where filter and a subquery. Note that you have to explicitly set suppress_filters to false, as get_posts normally ignores filters: function wpse28018_posts_where( $where ) { global $wpdb; $where .= ” AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_key = ‘alternate_page’ )”; return $where; } // … Read more

WordPress pagination with get_posts?

This is all sorts of wrong. First don’t use start_wp(); I think that was depreciated 4 years ago. Second your loop is messy, query_posts is for altering the main loop, aka not get_posts. So just write it normally using get_posts or WP Query. $args = array( ‘numberposts’ => 1, ‘offset’=> 0, ‘category_name’ => ‘carrs, dominicks, … Read more

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