Adding Blog Posts to Static Home Page
-
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
- The topic ‘Adding Blog Posts to Static Home Page’ is closed to new replies.