Nov 28 10

Adding WordPress Blog to Static HTML Pages


If you have a current website and you’re simply looking to use WordPress for a blogging page the easiest way to do this we have found is as follows:

  • Install WordPress (Either root or sub directory)
  • Find your Index.html file on your website and copy it to the WP Theme (whichever theme you are using) folder, and rename it Home.php. Note: If you’re using WordPress in a subdirectory you’ll need to edit all the links on the links and images links to ../
  • To add Posts add the following code to the Home.PHP file where you want your posts to appear:

<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
  <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
        <div><?php the_time( ‘M j y’ ); ?></div>
        <h2><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h2>
        <div><?php the_author(); ?></div>
    </div><!–end post header–>
        <?php if ( function_exists( ‘add_theme_support’ ) ) the_post_thumbnail(); ?>
        <?php the_content(); ?>
        <?php edit_post_link(); ?>
        <?php wp_link_pages(); ?>
    </div><!–end entry–>
        <div><?php comments_popup_link( ‘Leave a Comment’, ’1 Comment’, ‘% Comments’ ); ?></div>
    </div><!–end post footer–>
  </div><!–end post–>
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
    <div><?php next_posts_link( ‘Older Entries’ ); ?></div>
    <div><?php previous_posts_link( ‘Newer Entries’ ); ?></div>
  </div><!–end navigation–>
<?php else : ?>
<?php endif; ?>
<div id=”forsideinnhold”>

To add the WordPress Sidebar use the following code and place it in your Home.php code where you want it to appear:

<?php get_sidebar(); ?>

  • Once the data is copied and you have the look you want, change the permalink to /%postname%.html

  • For PAGES (Not POST) to use the HTML extension you need a plugin as WordPress only applies the Permalink structure to the posts. Recommended HTML Extension Plugin -> WordPress Hero
  • Share
    No tags for this post.

    Related posts



      follow me on Twitter







      Recover password