Problem with multiple loops in wordpress theme
The proper way to set up a secondary query, using your example code. Instead of this: $posts = get_posts(‘numberposts=1&order=DESC&orderby=post_date&category=’.get_cat_ID( ‘سیاست’ )); Do this: // Query args $custom_cat_args = array( ‘posts_per_page’ => 1, ‘order’ => ‘DESC’, ‘orderby’ => ‘post_date’, ‘cat’ => get_cat_ID( ‘سیاست’ ) ); // Instantiate query $custom_cat_query = new WP_Query( $custom_cat_args ); // Instantiate … Read more