Different number of posts per row in grid layout

This can be achieved by making use of Masonry a Cascading grid layout library Which is included in WordPress since 3.5 and has been updated to v3 with the release of version 3.9 of WP. It really is a nice tool to accomplish different kind of grid layouts. Of course it isn’t necessary to use … Read more

Split loop into columns

Try this: <div class=”all-posts”> <div class=”post-group> <?php $i = 0; if (have_posts() ) : while ( have_posts() ) : the_post(); if ($i%4 == 0) echo ‘</div><div class=”post-group”>’; ?> <div class=”post”> <?php the_title(); ?> </div> <?php $i++; endwhile; endif; ?> </div><!– end post-group –> </div><!– end all-posts –> You code was closing, opening and closing div … Read more

do_shortcode close

Use get_field instead of the_field. That way you can assign it to a varilable. $first_comment = get_field(‘first_content_block’); $second_comment = get_field(‘second_content_block’); echo do_shortcode(“[vr_jsp] $first_comment, $second_comment [/vr_jsp]”); I haven’t tried it, but see if that works.

Change position of entry title

If you’re adding the image directly in the editor, then the_content() will always echo the image. Which means the title can only be above the blog post or below it. You should try adding the image as a featured image. Take a look at this link to see how to add featured image support, and … Read more

Three Column Loop

The code that makes this a two-column layout is centered on the $st_cat_counter variable. This is incremented with each iteration and when it’s an even number ($st_cat_counter / 2) a row is closed and a new row is started: echo ‘</div><div class=”row”>’;} elseif ($st_cat_counter == 1) You should simply be able to change “/ 2” … Read more

How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()

You can ask the main query directly (which is, in fact, exactly what the is_front_page function is doing). <?php global $wp_query; ?> <?php if ( $wp_query->is_front_page() ) : ?> <div><?php the_content(); ?></div> <?php endif; ?> If you altered the main query, however, refer to the backup. <?php global $wp_the_query; ?> <?php if ( $wp_the_query->is_front_page() ) … Read more

Some doubts about how the loop work (trying debugging it)

<?php if (have_posts()) : while (have_posts()) : the_post(); endwhile; else: _e(‘No blog found.’, ‘polymer’); endif; ?> if(have_post) condition is to check if the page contain post, while(have_posts) condition if there is more than one post display in loop, the_post() is used to display the post if(have_post) condition fails it will go to else loop. Tell … Read more