Hi, I have this wordpress code, but i have a problem with "posts_per_page" function. He dosen't limit the 2 posts per page. Can you help me please? Thank you for your help <?php $display_count = ( get_option( 'cp_sys_top_ad_count' ) ) ? intval( get_option( 'cp_sys_top_ad_count' ) ) : 2; $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ); $args = array( 'post_type' => 'ad_listing', 'post_status' => 'publish', 'orderby' => 'rand', 'ad_cat' => $term->slug, 'meta_key' => 'cp_sys_top_price', 'posts_per_page' => $display_count, 'nopaging' => true ); $top_query = new WP_Query($args); ?> <?php if ($top_query->have_posts()) : ?> <?php while( $top_query->have_posts() ) : $top_query->the_post(); $highlight = get_post_meta( $post->ID, 'cp_sys_highlight_price', true ); $high_class = ( $highlight ) ? ' highlight_ad' : ''; ?> Code (markup):
Have you tried echoing the variable $display_count to make sure that you're actually getting a value?