WordPress.org

Ready to get started?Download WordPress

Forums

Adding Blog Posts to Static Home Page (3 posts)

  1. bigfatty
    Member
    Posted 1 year ago #

    I'm somewhat new to WordPress and trying to learn some new things. I followed instructions in a related post in order to have my static home page pull posts from my blog. The code provided in the post worked pretty good, but I encountered a few problems. I'm using the Twenty Ten theme with a child theme, and the child theme folder has a page.php file in it along with a style.css file. I imported the twentyten css stylesheet, but I didn't add any styles to it.

    1. My custom menu for the top navigation bar disappeared and it appears that WordPress reverted back to the default menu.

    2. No image appeared but I would like to have one appearing to the left of the post excerpt and under the title, similar to the way it does in the actual blog page.

    Below is the entire code of the new page.php template file I placed in the child theme folder. I used my original page.php file's code and added the first few lines of code that was provided in a related post I read in the forum:

    <?php
    /*
    Template Name: Front Page
    */
    ?>
    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    
    get_header(); ?>
    
    		<div id="container">
    			<div id="content" role="main">
    
    			<?php
    			/* Run the loop to output the page.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-page.php and that will be used instead.
    			 */
    			get_template_part( 'loop', 'page' );
    			?>
    
    <div id="frontpagepostpull">
    <?php $temp_query = $wp_query; ?>
    <?php query_posts('showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>">
    	<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <?php the_post_thumbnail('front-page-post-thumbnail'); ?>  <?php the_excerpt(); ?>
    	</div>
    <?php endwhile; ?>
    </div>
    
    			</div><!-- #content -->
    		</div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I deactivated my child theme, but here is the link to the site I am trying to develop: http://www.laketahoeweddings.net
    Thank you for any solutions.

    Kenny

  2. I'm pretty sure whenever you enable a child theme, you will lose any modifications to custom menus and page backgrounds. You will need to manually go back and add these again.

    So what exactly is your question here?

  3. bigfatty
    Member
    Posted 1 year ago #

    Thank you Josh. That was quite an easy fix. I sometimes get overwhelmed and overlook the obvious. My exact questions now are:

    1. My blog posts now appear on my home staic page with a short excerpt. Is there a way to have a post related thumbnail photo appear as well on my home page along side each post?

    2. I wanted text to appear above the posts saying "Featured Wedding Articles". I put this text in an h2 tag in the code of the page.php file. It worked, but is this the correct way to do it? (below is where I inserted the h2 text in the code)

    get_template_part( 'loop', 'page' );
    			?>
    <h2>Featured Wedding Articles</h2>
    <div id="frontpagepostpull">
    <?php $temp_query = $wp_query; ?>

    You can see what I'm talking about here: http://www.laketahoeweddings.net

    Thank you for your help.
    Kenny

Topic Closed

This topic has been closed to new replies.

About this Topic