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>
<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–>
<div>
<?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>
<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>
<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

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s