WordPress (How to keep my Layout)

From ReduxWiki

Jump to: navigation, search

WordPress appears to be one of the more popular, so I figured a small guide on how to get this software to output within your own layout could be useful.

[edit] Step 1

Login to WordPress refer to Options > Blog URL > Edit to http://www.domain.tld (The Location of Your Homepage)

Within the <head> tags of your index page include the following:

<?php define('WP_USE_THEMES', false); $blog = 1; require('blog/wp-blog-header.php');?>

"blog" in the above line is the sub directory into which you installed WordPress.

Image:Info-small.png Your index page will have to be a .php extension.

[edit] Step 2

Within the 'body' of your index page include the following:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
							
<div id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
<?php the_date(); ?> <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
							
<?php the_content(__('(more...)')); ?>
						
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
				
<?php comments_template(); // Get wp-comments.php template ?>
			
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>

<?php posts_nav_link('','','« Previous Entries') ?>
<?php posts_nav_link('','Next Entries »','') ?>


[edit] Related Articles


Image:Tip.png Back to How To Documents
Personal tools