I am working on a basic Wordpress website and wanted the home page to be a custom static page, so I have created a page called home.php
and and page called news.php
and then in the WP admin I've gone to: Setting
then Reading
selected the a static page
option, selected the Front Page
as Home and then the Posts Page
as News.
However when Ive gone to view the site in the browser both pages display the same content.. allthough the URL DOES change to what ever the page is ie: localhost:8888/mysite/home or localhost:8888/mysite/news
I'm not sure if i'm missing something really simple.. but I can't seem to figure out where I am going wrong?
My Code for the home page is:
<?php
/*
Template Name: Home Page
*/
?>
<?php get_header(); ?>
<div class="container">
<h1>This is the homepage</h1>
</div>
<?php get_footer(); ?>
and then my code for the News page is:
<?php
/*
Template Name: News Page
*/
?>
<?php get_header(); ?>
<div class="container">
<h2>This is the Blog page</h2>
<?php $args = array(
'post_type' => 'post',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 4,
'paged' => get_query_var('paged'),
'post_parent' => $parent
); ?>
<?php query_posts($args); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<article>
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
<time><?php the_time(get_option('date_format')); ?></time>
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
</article>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>
</div>
If anyone could help me try to figure out where I am going wrong, it would be greatly appreciated! :-)