First, I'm sorry for my bad english.
Ok, I'm using this code in single.php on my worpdress, it will make post horizontally
<?php
// Show a selected number of posts per row
$posts_per_row = 5;
$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 '<h2>';the_title();echo '</h2>';
the_excerpt();
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 {
// Code for no posts found
}
?>
But, the result is just Title and post summary, how I can make post title with permalink as the link, like this code
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
I think, I should edit
echo '<h2>';the_title();echo '</h2>';
So, can anyone tell me the correct code ?
Aucun commentaire:
Enregistrer un commentaire