Pagination on external php page
-
I’m loading WordPress categories into an external PHP page. Yes, it would be easy to run it all inside WordPress, but in this case that is not an option.
I am loading 4 posts at a time. I need to include pagination links at the bottom to load the next 4 posts into the same PHP page.
Here is what I have:
<?php // Include WordPress define('WP_USE_THEMES', false); require('./articles/wp-load.php'); query_posts('cat=9', 'posts_per_page=4'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="https://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php while (have_posts()): the_post(); ?> <?php endwhile; ?> <?php while (have_posts()): the_post(); ?> <h3><?php the_title(); ?></h3> <p><?php twentyten_posted_on(); ?> <?php the_excerpt(); ?></p> <hr /> <?php endwhile; ?> </body> </html>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Pagination on external php page’ is closed to new replies.