Display the first paragraph of 5 posts per page
-
Hey all,
This is probably very simple to do, but I’m new to PHP and WordPress, so please don’t hate me!
I’m trying to set up our companies news pages to display 5 posts per page, with the first paragraph of the post shown below the title and date.
The title and date is coming out fine, and the first parafgraph is displaying for posts 1-5 but not for the ones after.
I am using the code below, which I imagie is probably very long winded.
Any help with this is very much appreciated.
Thanks.
<ul> <? query_posts(array('cat' => 75, 'posts_per_page' => 5, 'paged' => $_GET['paged'])); if($_GET['paged'] == 1) $i = 0; else $i = 5*$_GET['paged']-5; if(have_posts()){ while(have_posts()){ the_post(); ?> <li> <h3 class="news_title_padd"><a href="<? the_permalink() ?>"><? the_title() ?></a> - <small><strong><? the_time('F jS, Y') ?></strong></small></h3> <p> <? $post = get_posts(array('cat' => 75)); $post = $post[$i]; $post->post_content = explode('.', strip_tags($post->post_content)); $post->post_content = $post->post_content[0]; $i++; ?> <p><?=$post->post_content?>. <a href="<?=$post->guid?>">Read more...</a></p> </p> </li> <? } } ?> </ul>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Display the first paragraph of 5 posts per page’ is closed to new replies.