Multiple Query_Posts

Your problem, first, is query_posts. Please don’t use query_posts. Just don’t. Create a new query just like you did when you created $loop. Second, your inner loop alters the global variable $post. You need to reset that with wp_reset_postdata() after that inner loop runs. I believe that will take care of it.

Can I use WP_Query one time and then filter the results multiple times

Wrap your WP_Query object in a function so you don’t have to change all the query $args. The function will pass parameters for custom field value and order by custom field value. Here how you can do it: <?php function custom_query($divided_cf_val=array(), $order_by_cf_val) { ?> <div id=”listings”> <?php $args = array( ‘post_type’ => ‘listing’, ‘post_status’ => … Read more

WordPress displays post on subcategory only

How can I remove the post from subcategory 1.2 on subcategory 1? Use the ‘category__in’ argument parameter instead of the ‘cat’ parameter. Here is a user function that does what you want. /** * Category post list. * * An unordered list of category posts links. Posts in subcategories * are not listed in parent … Read more

How can I list posts with different formats depending on order?

WP_Query will track which post is current. For example: $p = new WP_Query(array(‘post_type’=>’post’,’posts_per_page’=> 10)); if ($p->have_posts()) { while ($p->have_posts()) { $p->the_post(); echo $p->current_post.'<br>’; } } You could use that to selectively format your posts. For example $p = new WP_Query(array(‘post_type’=>’post’,’posts_per_page’=> -1)); if ($p->have_posts()) { while ($p->have_posts()) { $p->the_post(); switch ($p->current_post) { case 0: case 3: … Read more

specific post is not excluded from the loop

You’re just off by one letter it seems. post__not_in => array(118) Post & Page Parameters You can also try adding an if statement, such as: if($post->ID != 118) : … run rest of code Though not optimal, without seeing the rest of your template I can’t be certain. Additional Edit: <?php $loop = new WP_Query(array( … Read more

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