Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

custom wordpress front page

Posted on 2011-03-20
4
Medium Priority
?
327 Views
Last Modified: 2012-05-11
Hi what is the best way of having a custom front page on word press?

Thanks.
0
Comment
Question by:wilflife
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 35177489
Hi wilflife,

What exactly do you mean by "custom"?

A splash page?  Custom content instead of recent posts?
0
 

Author Comment

by:wilflife
ID: 35177492
Basically a different format on the front page to the other pages.
0
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 800 total points
ID: 35177509
So the problem with WordPress is that all of the redirection occurs from index if WordPress is installed in the public root and the theme is the theme.  If you have not yet installed it, then the easiest solution is to install WordPress one level down (www.yoursite.com/blog for example) and then use index.html as the different page.

Another solution is to detect where a user is coming from (internal or external to the domain) and serve up a different page as needed:

http://wordpresshero.com/hacks/creating-a-splash-page-for-wordpress.html/

A third option is to use a plugin:

http://wordpress.org/extend/plugins/simplesplash/
0
 
LVL 23

Accepted Solution

by:
jeremyjared74 earned 1200 total points
ID: 35178493
Another way to do it would be to create a custom page. Just copy your header.php, your page.php, sidebar.php, and footer.php. You will want to open a blank text document first. The first thing to put inside the new document is the part that allows you to use select if from the page type dropdown list in the WordPress post or page editor:
HERE IS THE ENTIRE CODE FOR THE EXAMPLE CUSTOM PAGE:
<?php

/*

Template Name: Custom Name

*/

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<title><?php if ( is_home() ) { ?><? bloginfo('name'); ?> <?php bloginfo('description'); } else { wp_title(' '); ?> by <? bloginfo('name'); } ?></title>
 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
 
<link rel="shorcut icon" type="image/x-ico" href="<?php bloginfo('template_url'); ?>/favicon.ico" />
 
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
 
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/imghover.js"> </script>
 
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
 
<?php wp_head(); ?>
</head>
<body>
 
<!-- header START -->
<div class="Header">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
<div class="Desc"><?php bloginfo('description'); ?></div> 
<!-- header END -->
 
<!-- container START -->

<div class="Container">


<!-- Here is the page.php code example -->


<div id="content" class="narrowcolumn single-page">

    <div class="post-wr">

<div class="post-foot">
                <div class="post-body">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
		<h2><?php the_title(); ?></h2>
			<div class="entry">
				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>

				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

			</div>

		</div>

		<?php endwhile; endif; ?>

	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
	

	
<!-- Begin Sidebar.php -->	
	

	<div id="sidebar">


<?php

	if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>

<?php get_search_form(); ?>

	<h3><?php _e( 'Archives', 'twentyten' ); ?></h3>

<?php wp_get_archives( 'type=monthly' ); ?>

<?php endif; // end primary widget area ?>

<?php

	if ( is_active_sidebar( 'secondary-widget-area' ) ) : ?>

<?php dynamic_sidebar( 'secondary-widget-area' ); ?>

<?php endif; ?>

	</div>

		</div>
		
<!-- Here is the footer -->

  </div>
</div>
<div id="footer">
<p>Your Text Here, maybe a picture or a custom widget</P>
</div>
<?php wp_footer(); ?>

</div>
  </div>
    </div>
      </div>

</body>

</html>

Open in new window

You just need to note the <div id="whaterver">, and the <div class="anyname">, then style them as you wish using css,
Example:
.anyname{
    display: block;
    height: 100%;
    width: 800px;
     float: left;
}
#whatever {
    display: block;
    height: 100%;
    width: 800px;
     float: left;
}

Open in new window

Make sure you saved your custom page template the same as it is in the top of the file, upload it to your theme folder, then include the css to make it look like you want. When you are in the text editor fro the homepage, you will pick your custom page from the page style drop-down list and save it. Hope that helps.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What's this? As a volunteer Page Editor for Experts-Exchange.com, I have noticed that many authors also have blogs, and pull articles from their blogs to post at Experts-Exchange. I appreciate each author sharing their blog content with our site …
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question