Why is my archive page looping through all but one post?

As @Jacob Peattie says, pagination is what’s causing this, and probably what you want to add if you will have more posts over time. If you want you can disable pagination for archive pages easily with this in your functions.php: function wpse_disable_pagination( $query ) { if (is_archive()) { $query->set(‘nopaging’, 1 ); } } add_action( ‘pre_get_posts’, … Read more

How to display fields from the loop in two separate divs

A simple solution would be just run the loop twice. <?php // set loop $args here so they’re in once place ?> <div class=”four”> <?php // run the loop once with $args, output left side items ?> </div> <div class=”five”> <?php // run the loop again with $args, output right side items ?> </div>

php loop error for count posts in category

I have a working solution now… finally! <?php foreach ( $categories as $category ) { // If there is only one post available, go directly to the post if($category->count == 1) { $all_posts = get_posts($category); echo ‘<div class=”item”><h4 class=”item-title”>’ . get_the_title($all_posts[0]->ID) . ‘</h4><a href=”‘ . get_permalink($all_posts[0]->ID) . ‘”>Read more</a></div>’; } else { echo ‘<div class=”item”><h4 … Read more

get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title

Not sure if this’ll work for you because I don’t know if $attachment_ID in the function is returning anything at all… …but assuming it is: function custom_pic_alt( $attachment_ID ) { //var_dump( $attachment_ID ); //uncomment this and see if it even returns anything. $thumb_alt = get_post_meta( $attachment_ID, ‘_wp_attachment_image_alt’, true ); $thumb_caption = wp_get_attachment_caption( $attachment_ID ); $thumb_title … Read more