Forums

[resolved] Force Blog Feed onto Custom Static Home Page (4 posts)

  1. kbeckett
    Member
    Posted 4 months ago #

    I have used the instructions provided here (http://codex.wordpress.org/Creating_a_Static_Front_Page) to create a static front page for my blog/website - http://broadcast.cm4draft.net/. I have a custom page template set up and assigned to the static Home page that allows me to use a different set of sidebar widgets and teasers at the top of the site. I do not want these to appear on any other pages. I am not a PHP coder, but I can usually find strings of code needed by digging around in files or searching the web.

    MY ULTIMATE QUESTION IS... How in the world can I force the homepage into displaying the blog feed instead of showing the PAGE content? I'm guessing there is a string of code I can place in my "custom-home.php" file that will tell WordPress to treat the page like the main blog feed rather than a page.

    Once this is working, my plan is to use this technique (http://codex.wordpress.org/Template_Tags/query_posts) to set the custom front page to tease only 2-3 most recent blog postings.

    Any ideas would be much appreciated - thanks!

  2. jdavhar
    Member
    Posted 4 months ago #

    <?php query_posts('post_status=publish&posts_per_page=3&post_type=post');?>
    		<div id="container">
    <div id="content">
    <?php if ( ! have_posts() ) : ?>
    	<div id="post-0" class="post error404 not-found">
    		<h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
    		<div class="entry-content">
    			<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
    			<?php get_search_form(); ?>
    		</div><!-- .entry-content -->
    	</div><!-- #post-0 -->
    <?php endif; ?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<p><?php the_time('F j, Y \a\t g:i') ?></p>
    <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
    	<p><?php the_excerpt(); ?></p>
    	<?php endwhile; else: endif; ?>
    		</div></div><!-- #container -->
  3. kbeckett
    Member
    Posted 4 months ago #

    Thank you, jdavhar. Looks like that got me most of the way there! Now I just need to figure out how to get my theme styling to apply to it and I'll be set. Thanks for your accurate assistance and quick reply. Cheers!

  4. monkeyprint
    Member
    Posted 3 months ago #

    Hi

    I have used this code - question is how do I limit the blog items to only onepage (frontpage) andybody know the code to do this?

    Iain

Reply

You must log in to post.

About this Topic