Front-end Web Developer | Tampa, FL

How to customize Front Page layout WordPress

Posted on: December 29th, 2009 by admin No Comments

 

 

1. Adding simple code in Your active Theme pages:

{CODE type:php;}
<?php if ( is_front_page() ) {?>
html for home page
<?php }else{?>
html for other pages
<?php }?>
{/CODE}

For example we want to customize content and remove sidebar from Home Page, we need change page.php in default Theme. Open page.php, You can find it on FTP: wp-content/themes/default/page.php and add this code:

{CODE type:php;}
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/

get_header(); ?>

<?php if ( is_front_page() ) {?>

<div id=”content” class=”HomePageNarrowcolumn” role=”main”>

</div>

<?php }else{?>

<div id=”content” class=”narrowcolumn” role=”main”>

</div>
<?php get_sidebar(); ?>

<?php }?>

<?php get_footer(); ?>
{/CODE}

 

2. The second way add home.php in Your active Theme. WordPress will recognize a home.php document in your template directory and use it rather than index.php to theme Your front page.

 

3. Front Page Plugin For WordPress.
The Opt-In Front Page plugin lets you add posts to your front page on an opt-in basis, rather than remove posts on an opt-out basis. This allows you to manage any number of asides categories.

In short, only posts in your “Blog” (or “News”) category will appear on your front page and its RSS feed when you use this plugin.

It changes your main category’s url as relevant, and it fallbacks to normal blog mode when no ‘blog’ (or ‘news’) category exists or when the latter is empty.

You can safely change your “Blog” or “News” category’s name after it is created: The opt-in front page plugin looks for the category with a slug of “blog” or “news”.

Download this plugin

 

In conclusion i want to say that You can use all this variants. In my WordPress projects I used first variant with php code as for me its more simple 🙂

Comments are closed.