Can’t grab author info outside of the loop

For your author box to work, it needs to be inside the loop. You have one fundamental flaw though with your second loop. You are currently using two different loops in one, the first one being the main loop, and the second one a custom loop to fetch related posts As it stand, and where … 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

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

Altering “posts_per_page” for defaut loop

As Tom said, that will never work, as the main query have already executed. The only way to achieve that is to alter the main query before it is executed. There is a action hook for that, pre-get_posts and this is the correct method to alter the main query. Example: function wpse_custom_ppp( $query ) { … Read more

Problem with Front-Page.php loading recent posts

You have to reset every instance of a custom query, otherwise you will get unexpected output from any other query there after Simply use wp_reset_postdata() after every custom query. Example <?php $args = array( ‘numberposts’ => ‘1’, ‘meta_key’=>’_thumbnail_id’ ); $recent_posts = wp_get_recent_posts( $args ); foreach($recent_posts as $post) : ?> <?php get_template_part( ‘content’, ” ); ?> … Read more

Multiple instances of Featured Image Thumbnail As A Background On Homepage

Solution was to remove the style tag and and write the background styling right into the .featured_box div. Thank you to @ckhicks on Twitter for the solution, and thank you everyone else for trying to help out too <3 <?php $background = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), ‘full’ ); ?> <a href=”https://wordpress.stackexchange.com/questions/160701/<?php the_permalink(); ?>”><div class=”featured_box” style=”background: … Read more