Calling the featured image
-
I’m trying to create a category page that lists posts by featured image thumbnails and titles only. I’m using the code:
<?php // Show a selected number of posts per row $posts_per_row = 4; $posts_per_page = 20; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => $posts_per_page, 'paged' => $paged, ); query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); if ((++$post_counter % $posts_per_row) == 1 || $posts_per_row == 1) { if ($post_counter > 1) { echo "</div><!-- End of post_row -->\n"; // End previous row } echo "<div class='post_row'>\n"; // Start a new row } echo "<div class='post_class'>\n"; // Start one post // Output post data here echo ' <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a> <h3><a href="<?php the_permalink() ?>"> <?php the_title(); ?></a></h3>'; echo "</div><!-- End of post_class -->\n"; // End of post } ?> </div><!-- End of post_row --> <div class='clear'></div> <div class="navigation"> <div class="alignleft"><?php next_posts_link('? Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries ?') ?></div> </div> <?php } else { } ?>
But it’s not working. What am I doing wrong? Can anyone help please?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Calling the featured image’ is closed to new replies.