WordPress Creating a Static Front Page

WordPress Creating a Static Front Page

         Wordpress shows your recent post in order on the front page of your site.  Front page Customize  on the your site. WordPress user want a static page as the front page instead.  This static page look is common for users desiring static page on the front page of the site. Login Page Custom WordPress

creating a static front page

 static front page



Blog posts on static front page


That worked great. Just for anyone finding this post, what I have accomplished is pulling in blog post content into a 'static' page template so that I have static content and blog content on the same page. Here is the code I used with both loops, the first being the blog content loop and the second being the standard page template loop for static content: Display Random Post 

<?php $my_query = "showposts=3"; $my_query = new WP_Query($my_query); ?>
<?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>

 <!-- standard tags to display blog post information like the_title() here -->

<?php endwhile; // end of one post ?>
<?php endif; //end of loop ?>

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

 <!-- standard tags to display the static page information like the_title() here -->

<?php endwhile; endif; ?>

Only show sidebar on home page

edit your sidebar.php file, found in the theme files in the /wp-content/themes/{theme-name} folder

put this as the first line:

<?php if ( is_front_page() ) { ?>
and this as the last line:
<?php } ?>
That will cause the sidebar contents to only display on your home page.

<?php }
else {
 ?>


WordPress Creating a Static Front Page Dev2Tricks 5 of 5
WordPress Creating a Static Front Page          Wordpress shows your recent post in order on the front page of your site.  Front page Cu...

Share this

Related Posts

Previous
Next Post »

Xolo Offer