WordPress.org

Support

Support » Themes and Templates » Turnout Mag Theme – Modifying index.php

Turnout Mag Theme – Modifying index.php

  • Hey everyone. I’m using the Turnout mag theme for a site. It’s a great theme that lays out all the posts in a grid layout. Here is the site:
    http://www.currybear.com/wordpress/

    What I wanted to do was modify it so that the latest entry is highlighted and perhaps change the color of the “box”. Unfortunately, the php code in index.php goes through a for loop to list all the posts in boxes. I am not sure if there is a way for me to display the first post differently. I ran into a road block with this and can’t think of any solutions. Would appreciate any help from the wise members on this forum.

Viewing 1 replies (of 1 total)
  • esmi
    Forum Moderator

    @esmi

    Assuming that the start of your current Loop looks something like:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post">

    you could try changing it to:

    <?php $c = 0;$style = ''; ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php $c++;
    if( $c == 1 ) $style=' highlight'; ?>
    <div class="post<?php echo $style;?>">

    That should add the class “first” to the most recent post only. You could then use this class in your theme’s stylesheet to highlight the most recent post – e.g.:

    `#content .post .first {border-color:#FF9000;}

Viewing 1 replies (of 1 total)
  • The topic ‘Turnout Mag Theme – Modifying index.php’ is closed to new replies.