Blog embedded into static site, 'older posts' link not working
-
Hello,
I have a static XHTML site into which I have plugged in a WordPress news blog. I have left all of the .html files intact, added a ‘news’ folder with wordpress in it, and just added another page in the root directory with mostly the same XHTML code, except it has a .php suffix.
At the beginning this page has:<?php // Include WordPress define('WP_USE_THEMES', false); require('./news/wp-load.php'); query_posts('showposts=3'); ?>
and somewhere in the body it has the loop:
<?php if(have_posts()) : while(have_posts()) : the_post(); ?> <?php the_title('<h2 class="entry-title"><a title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?> <div class="entry-content"> <?php the_content(__('Continue reading', 'example')); ?> <?php wp_link_pages('before=<p class="pages">' . __('Pages:','example') . '&after=</p>'); ?> </div> <?php endwhile; ?> <?php else : ?> <p class="no-posts"><?php _e('Sorry, no posts matched your criteria', 'example'); ?></p> <?php endif; ?>
All this works well, the latest 3 posts just appear (and they are automatically styled by the same CSS file as the rest of the site, which I really like). However, older posts drop off, because of that line at the beginning of the page. So I’d like to be able to have a link to older posts, with that page being dynamically created. This here doesn’t seem to work, it always points to a page inside the wordpress directory:
<?php posts_nav_link('sep', 'pre', 'next') ?>
So instead of
http://localhost:8888/news.php/page/2 (or something like that)
it points to:
http://localhost:8888/news/news.php/page/2I’ve tried editing the Permalinks, but without effect.
-
Let me answer that myself.
It was a bad idea to remove the .php page from the wordpress directory. I’ve moved it into there and now the 2nd/3rd and so on pages work. (All the static html pages are still in the root dir, which is fine)
Also, the bit at the top needs to say:
<?php // Include WordPress define('WP_USE_THEMES', false); require('wp-blog-header.php'); ?>
oops. Then of course there’s this here, which answers my question and makes the initial idea possible:
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
- The topic ‘Blog embedded into static site, 'older posts' link not working’ is closed to new replies.