Create Home Page in Wordpress Blog
All bloggers would expect this post, You may think it will be good if you have a home page for your blog and it will look like a website. Yes its possible to create home page in wordpress blog. Here i give you some steps.
1. Open your template folder and open index.php in a text editor (ex: notepad)
2. Save the file as home.php
3. Now you can edit home.php like whatever you want to display in your home page ( like about your blog or about you so and so.
4. If you need to display recent posts of your blog in home page paste this code.
<?php
$how_many=5; //How many posts do you want to show
require_once(’wp-config.php’); // Change this for your path to wp-config.php file ?><ol id=”whats-new”>
<?
$news=$wpdb->get_results(”SELECT `ID`,`post_title` FROM $wpdb->posts
WHERE `post_type`=”post” AND `post_status`=”publish” ORDER BY post_date DESC LIMIT $how_many”);
foreach($news as $np){
printf (”<li><a href=”index.php?p=%s”>%s</a></li>”, $np->ID,$np->post_title);
}?>
</ol>
5. If you Sidebar and Footer Add
<?php get_sidebar(); ?>
<?php get_footer(); ?>
6. Now upload home.php to your template folder.
And now you have modify .htaccess file in your home directory
At the top of the .htaccess file add
DirectoryIndex home.php index.php
Visit your blog now You will get a home page with list of your recent posts.
Example see my personal blog.
You can also use any of your page as home page.
Here are the steps.
1. Create new page like About as ur wish
2. Go to Settings-> Reading
3. In Front page displays click A static page in front page select your page which you created now.
4. Save changes and visit you blog.
Tags: wordpress
One Response to "Create Home Page in Wordpress Blog"
Helpful post. I am going to dig this and subscribe to your feed. Thanks ah.