How to make a single wordpress post as the homepage or a static page?

7 replies
  • WEB DESIGN
  • |
Hi,

I've been trying to do this for a while and I'm not able to get it working.

I would like this post:

http://douglassvilletownhomes.com/?p=11

to be my home page.

I've tried making a custom template that calls the post but I dont think I did it right and doesn't display everything properly.

I used the following code, but it doesn't seem to pull the data properly.

<?php /* Template Name: PostDisplayTemplate */ ?>

<?php get_header(); ?>


<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<h2 class="h2-section h2-property"><?php the_title(); ?></h2>

<?php include(TEMPLATEPATH . '/lib/inc/details.php'); ?>

<h2 id="h2-description" class="h2-section"><?php _e('Description',TS_DOMAIN); ?></h2>

<div id="post-<?php the_ID(); ?>" class="box3 description clearfix">

<?php the_content(); ?>

<?php the_tags('<p class="post-tags">'.__('Tags').': ', ', ', '</p>'); ?>

</div>

<?php include(TEMPLATEPATH . '/lib/inc/photos.php'); ?>

<?php include(TEMPLATEPATH . '/lib/inc/location.php'); ?>

<?php include(TEMPLATEPATH . '/lib/inc/contact.php'); ?>

<?php // comments_template(); ?>

<?php endwhile; ?>

<?php else : ?>

<h2 id="h2-404" class="h2-section"><?php _e('Sorry, not found!',TS_DOMAIN); ?></h2>

<div class="box3 clearfix">

<p><?php _e('Sorry, no entries matched your criteria.',TS_DOMAIN); ?></p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>

</div><!-- end post -->

<?php endif; ?>

<?php get_footer(); ?>

Does anyone have any idea how I can make this work?? Help!!

Thanks!
#homepage #make #page #post #single #static #wordpress
  • Profile picture of the author alistair
    Why don't you just make it a page and then set it as the home page?
    {{ DiscussionBoard.errors[3914553].message }}
  • Profile picture of the author Rabs1979
    I tried doing that but for some reason, it doesn't pull the post. How do I call a particular post when I know the post number exactly?
    {{ DiscussionBoard.errors[3914597].message }}
  • Profile picture of the author alistair
    All I know that if it was me I'd probably copy the contents of the post and paste it into a new page and then delete the post. I like to make things simple, plus I don't know anything about coding, not much anyway.
    {{ DiscussionBoard.errors[3914673].message }}
  • Profile picture of the author xtrapunch
    For progammatically changing HOME PAGE and BLOG PAGE, paste the following code in functions.php. Make sure to replace
    HOME_PAGE_ID and BLOG_PAGE_ID with actual page IDs

    // Use a static front page
    update_option( 'page_on_front', 'HOME_PAGE_ID' );
    update_option( 'show_on_front', 'page' );

    // Set the blog page
    update_option( 'page_for_posts', 'BLOG_PAGE_ID' );
    Just realize, you are trying to make a page as home page. Here's the solution: http://css-tricks.com/snippets/wordp...custom-fields/
    Signature
    >> Web Design, Wordpress & SEO - XtraPunch.com <<
    Web Design & SEO Agency | Serving World Wide from New Delhi, India

    {{ DiscussionBoard.errors[3914906].message }}
  • Profile picture of the author andrejvasso
    I dont know much about wordpress, but isnt there a simple option to do so?

    If i recall it correctly its in Settings > Reading Settings and there you can choose if you want a static home page and select what page to use.
    {{ DiscussionBoard.errors[3915924].message }}
  • Profile picture of the author Istvan Horvath
    Setting a Page as home/front page is built in. Use it.

    No, you can NOT use a post as a home/front page.

    Everything else is overcomplicating it...
    Signature

    {{ DiscussionBoard.errors[3915930].message }}
  • Profile picture of the author beck13
    great tip xtrapunch, very helpful link also!
    {{ DiscussionBoard.errors[3924138].message }}

Trending Topics