Adding WordPress loop to a static .php file
-
Hello,
I just added a WordPress loop to a page on a static website.
The page is located at:
http://protectionalarms.com/news/
WordPress is installed at: http://protectionalarms.com/wp
What I need is a next/lest button for pagination. I tried some code I found but it kept giving me a 404 error inside the WordPess site. I don’t want the public to see the WordPress site at all.
The loop I used is:
<!-- Start the Loop. --> <?php query_posts('showposts=5'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="post"> <!-- Display the Title as a link to the Post's permalink. --> <div class="title"><?php the_title(); ?></div> <!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div> <!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <div class="entry_date"><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></div> </div> <!-- closes the first div box --> <!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?> <!-- The very first "if" tested to see if there were any Posts to --> <!-- display. This "else" part tells what do if there weren't any. --> <p>Sorry, no posts matched your criteria.</p> <!-- REALLY stop The Loop. --> <?php endif; ?>Any ideas of how to make this work?
Thanks,
Micah
The topic ‘Adding WordPress loop to a static .php file’ is closed to new replies.