I'm working on my first wordpress blog site and I think I'm doing pretty good. This is my site so far but I need some help with a couple things as I'm not sure why this is happening. I've styled my blog the way I want to (with the clickable title and the dark red background for the "POSTED ON:" date stamp, however when I styled that, ALL my pages got that styling too (I only want that styling on the blog not).I want my pages to just look like regular pages. I understand CSS & HTML, and a SMALL bit of PHP but I'm not understanding why my index is picking up that styling. I do understand, through using firebug, that the styling class is the same as the blog posts but I don't want that. How do I change it is the only code on my index page is this...

<div id="main">
        <?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', 'page' ); ?>
        <?php endwhile; // end of the loop. ?>
</div><!-- #main -->

I don't understand where it's picking the styling up and which php page to change it on. If anyone can help me I'd appreciate it.

@Brad Farleigh (or really anyone who can help me):

I made a copy of the index.php page and called is page.php


<div id="main">

        <h1 class="entry-title"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>

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


A referenced page in the index page like this.

<div id="main">

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

                <?php get_template_part( 'page' ); ?>

                <?php endwhile; // end of the loop. ?>

        </div><!-- #main -->

So my pages seem to be working the way I want them to. Calling the content and titles, however now when I got to my blog it's all messed up. Understandably content-page.php has to be called from somewhere but where?

I very much appreciate the help.

  • does your theme have a content-page.php and why are you calling the template part 'page' on the index?
    – Michael
    Apr 4, 2012 at 11:26
  • you're iterating trough your posts in your index template, but within that loop you are including the page template which does the same loop again. This is probably causing infinite recursion because of WP's random global variables :) So, remove the loop from page.php (the "if" block) Apr 4, 2012 at 18:02
  • I did that, but no luck. Still the same outcome. Any other ideas? It seemed like a reasonable answer.
    – kia4567
    Apr 4, 2012 at 18:08
  • try choosing a different name for your custom template. "page" is a default template (used by pages) Apr 4, 2012 at 18:10
  • No luck. I pointed the index.php to a mine.php page but it's still reacting the same.
    – kia4567
    Apr 4, 2012 at 20:48

2 Answers 2


I think you just need to add your body "blog" class before your own css style like below:

.blog .entry-subtitle {
width: 100%;
height: 36px;
line-height: 36px;
letter-spacing: 1px;
color: white;
font-weight: normal;
font-size: 1em;
text-indent: 15px;
margin-top: -10px;
background-color: #761616;
text-transform: uppercase;

It should works.

  • Thanks. That removed the styles but I still have the post date there, however if I remove it, it removes the date from my blog too. They are both the same page I believe, do you know how I might separate these files into their own identity? I have edited my questions above, maybe you can see what I should be doing?
    – kia4567
    Apr 4, 2012 at 17:51
  • Because your blog page's body tag has a class named "blog" that I found by Firebug. So simply you just need to add .bolg selector before every css style you want to add to your blog page. It will not affect other page.
    – Tim Yao
    Apr 4, 2012 at 23:59
  • Regarding the date box. You can define your own loop to get rid of this date box by using your own content-xxx.php. Also there is another easy way just use css style dispaly:none to hide the date box on all page. At the same time you can use the .blog selector to give a different style to blog page.
    – Tim Yao
    Apr 5, 2012 at 0:12

By default wordpress will display posts and pages based on the layout defined in index.php but you can override these using the template heirarchy.

The wordpress template heirarchy is best explained here. Also, This is a great diagram which shows you what templates control website components.

You can check what page template can have control over a page by using firebug to inspect the class on your tag. For example your "wine law" page body tag currently has the class of "page page-id-67 page-template-default single-author" which shows that you could customise the layout using the page.php file (which would effect all 'pages'), or even create a page-67.php file which would control that page only, as "67" is the page ID.

To answer your question - you could duplicate the index.php file (it'll depend on your template though) and rename it 'page.php' then remove the part of the code that displays the section which is showing the date.

I hope that helps!


  • I can't copy over my index.php page and change the the code that displays the date as it only has a reference to content-page.php (which is where all the code is and it dictates for the blog too). If I'm even understanding this at all might I be able to copy and past index.php, call it page.php, create a page.ph file and replace the <?php get_template_part( 'content', 'page' ); ?> with <?php the_content(); ?> ?
    – kia4567
    Apr 4, 2012 at 17:35
  • Please see my edited question above. I've added a bit more. I appreciate the help Brad.
    – kia4567
    Apr 4, 2012 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.