filter on get_posts efficiently

You could use a taxonomy query to make it cleaner and easier to read; I’m not sure if this would be any faster than the way you’re doing it, though. $args = array( ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘name’, ‘terms’ => array( ‘Europe’, ‘local’ ), ‘operator’ => ‘IN’, … Read more

View post with specific category id and name which I selected in the backend (drop-down option)

Try this code. <?php $cat_id = get_theme_mod(‘cat_choose’, $defaults); ?> <p><?php echo get_cat_name( $cat_id ); ?></p> <hr> <?php $args = array( ‘post_type’ => ‘post’ , ‘orderby’ => ‘date’ , ‘order’ => ‘DESC’ , ‘cat’ => $cat_id, ‘posts_per_page’ => -1, ); $cat_posts = new WP_query($args); if ($cat_posts->have_posts()) : while ($cat_posts->have_posts()) : $cat_posts->the_post(); ?> <div> <div> <h1><?php the_title(); … Read more

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