Different Loop for tag pages?

Your code is trying to use if statements to control which if statements are being used, etc, which is meta programming. It will not work, and it can never work. <?php if ( is_tag() ) { if ( have_posts() ) { while ( have_posts() ) { the_post(); } else { $paged = ( get_query_var(‘paged’) ) … Read more

Display specific page (that is child) content on parent page

You were being too specific/not passing the correct parameters into your wp_query. This should get you what you’re looking for: <?php $current_page_id = get_the_id(); $investor_content_query = new WP_Query( ‘post_parent’=> $current_page_id ) ); if ( $investor_content_query->have_posts() ) { while ( $investor_content_query->have_posts() ) { $investor_content_query->the_post(); the_content(); } } wp_reset_postdata(); ?>

How to separate posts loop in to two columns? [duplicate]

<?php $row_start = 1; while ( have_posts() ) : the_post(); if( $row_start % 2 != 0) {// odd ?> <div class=”left-side”> <?php get_template_part( ‘blog’,’item’); ?> </div> <?php } if( $row_start % 2 == 0) {// even ?> <div class=”right-side”> <?php get_template_part( ‘blog’,’item’);?> </div> <?php } ++$row_start; endwhile; ?> You could always break in and out … Read more

How to Order By Two Custom Fields?

You can try this by using meta query to filter results and then adding orderby to order results. Below arguments should work $args = array( ‘post_type’ => array(‘post’, ‘video’), ‘meta_key’ => ‘pp_like_count’, ‘orderby’ => ‘meta_value_num’, “meta_query” => array( array( “key” => “pp_lang”, “value” => “english”, “type” => “CHAR”, “compare” => “=” ), ), );

Getting the Most Recent Posts from Multiple Categories

I use the following for multiple post types, just replace foo and bar with your own post types: $args = array( ‘post_type’ => array( ‘foo’, ‘bar’ ), ‘orderby’ => ‘post_date’, // other parameters as needed ); $q = new WP_Query( $args ); if ($q->have_posts()) : while ($q->have_posts()) : $q->the_post(); // do stuff endwhile; endif;

Random post link generator messes up the loop

Ok, thanks to The Maniac for all the help troublshooting. Looks like I had to take this completely outside the loop and call the WP_Query class on a new variable to make it happen. Here’s what worked: <?php $query = new WP_Query( array ( ‘orderby’ => ‘rand’, ‘posts_per_page’ => ‘1’ ) ); while ( $query->have_posts() … Read more