Creating a blog page
-
I would really appreciate the help on this one.
I have a page_blog.php that is job to fetch news from the database and display them by date. I have tweaked the code a little bit so that I can skip the first 4 articles (because they are being posted on the mainpage) once skipped, it’ll start displaying 8 articles per page.
The problem is, when I click on “next page”, it takes me to /page/3 but the articles are staying the same, what I really want is the articles to change in the next page as well.
This is my code
<?php get_header(); ?> <div id="content"> <div id="contentleft"> <div class="postarea"> <?php // include(TEMPLATEPATH."/breadcrumb.php");?> <br /><br /> <!--The blog page template is currently set to show 5 posts. Change showposts=5 to whatever number of posts you want to display.--> <!--Replace cat=1 with the Category ID you want to display in this section. See the README file to learn how to locate the Category ID--> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=8&offset=4"); while ( have_posts() ) : the_post() ?> <?php $arabic=""; foreach((get_the_category()) as $category) { if($category->cat_name=="Arabic"){ $arabic='1'; echo '<div style="text-align:right;">'; } } ?> <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1> <?php if($arabic=="1"){ the_excerpt_rereloaded('50','<strong>تـتـمـة</strong>','<a>,<i>,<em>,<b>,<strong>,<ul>,<ol>,<li>,<span>,<blockquote>','plain'); } else{ the_excerpt_rereloaded('50','<strong>Suite</strong>','<a>,<i>,<em>,<b>,<strong>,<ul>,<ol>,<li>,<span>,<blockquote>','plain');} ?> <div class="hpfeedmeta"> <p><?php the_time('j F, Y'); ?> | <?php comments_popup_link('Aucun commentaire', '1 Commentaire', '% Commentaires'); ?></p> </div> <?php if($arabic=="1"){ echo '</div>'; } ?> <div class="postmeta2"> <?php //the_tags('') ?> </div> <?php endwhile; ?> <p align="right"><strong><?php if(get_query_var('paged')=='2'){ echo '<a href="/">« Accueil</a> | '; next_posts_link('Page Suivante »'); }else{ posts_nav_link(' | ', '« Page Précédente', 'Page Suivante »'); } ?></strong></p> </div> </div> <?php include(TEMPLATEPATH."/sidebar.php");?> </div> <!-- The main column ends --> <?php get_footer(); ?> -
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.
If you don’t understand the difference, you may find this information helpful.
-
- The topic ‘Creating a blog page’ is closed to new replies.