Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:11:21+00:00 2026-06-05T05:11:21+00:00

here is my blog page template: <?php /** * Template Name: Blog * *

  • 0

here is my blog page template:

<?php
/**
 * Template Name: Blog
 *
 * Standard blog template, create a static page for your blog and select this as the template.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.    
 */

get_header(); ?>

<div id="main_container">

<!-- IE7 float fix --><!--[if lt IE 7]><span class="iefix">.</span><![endif]-->

<div class="main">

        <div class="entries_full">

            <div class="entry_full">

            <div class="box_twothirds mt30 pr60">

<!-- BLOG POSTS BEGIN -->
<?php
$exclude_cat = get_option('bb_exclude_cat');
$exclude_temp = str_replace(",", ",-", $exclude_cat);
$exclude_cats = "-" . $exclude_temp;
$blog_posts = get_option('bb_blog_posts');
if($blog_posts == NULL) {$blog_posts = '5';}
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query('cat=' . $exclude_cats . '&paged=' . $paged . '&showposts=' . $blog_posts);
$count = 0;
while ($wp_query->have_posts()) : $wp_query->the_post();
?>

<div class="blog">

<!-- displays the blog posts -->
<?php $count++; if($count > 3) { $count = 1; } ?>

            <h3 class="<?php if($count > 1) echo "mt25 "; ?>mb12"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>

            <?php if(get_post_meta($post->ID, large_image_value, $single = true) != NULL || get_post_meta($post->ID, fullsize_value, $single = true) != NULL)
            { ?>
            <div class="mag_blog"><!-- magnifying glass div -->
    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php if (get_post_meta($post->ID, large_image_value, true) != NULL) {echo get_post_meta($post->ID, large_image_value, $single = true);} else if (get_post_meta($post->ID, fullsize_value, true) != NULL) {echo get_post_meta($post->ID, fullsize_value, $single = true);} else {echo get_post_meta($post->ID, accordion_image_value, true);} ?>&amp;h=213&amp;w=600&amp;zc=1" alt="<?php the_title(); ?>" /></a>
        </div><!-- end magnifying glass div -->
        <?php } ?>
            <p class="meta"><span class="postdate"><?php the_time('F jS, Y') ?></span><span class="tags"><?php the_category(', '); ?></span><span class="comments"><a href="<?php the_permalink(); ?>#comments" title="comments"><?php comments_number('0 comments','1 comment','% comments'); ?></a></span></p>
            <?php global $more; $more = false; ?><?php the_content('<span>Continue Reading</span>'); ?><?php $more = true; ?>

            <div class="bar mt25 mb30"></div>

            <?php comments_template( '', true ); ?>
</div>

<?php endwhile;
if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if (  $wp_query->max_num_pages > 1 ) : ?>
            <?php next_posts_link( __( '&larr; Older posts', 'twentyten' ) ); ?>&nbsp;
            <?php previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) ); ?>
<?php endif; ?>

<?php }
$wp_query = null; $wp_query = $temp; ?>
<!-- BLOG POSTS END -->

            </div>

<!-- Begin Sidebar -->
<?php include('sidebar.php'); ?>
<!-- end sidebar -->

            <div class="clear"></div>

            </div><!-- end div.entry -->

        </div><!-- end div.entries -->

<div class="clear"></div>

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

<div class="clear"></div>

</div><!-- end div#main_container-->

<?php get_footer(); ?>
</code>

Just wonder if there is a way to add a class to the first blog item, or a way to make the first block item has different style than the rest… Or I need to edit on other php file?

Thanks guys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:11:23+00:00Added an answer on June 5, 2026 at 5:11 am

    You can do exactly that within the first line of your while() loop:

    Replace:

    <div class="blog">
    

    With:

    <div class="blog<?php if ($count === 0) echo " first_post"; ?>">
    

    That should add a custom class to the first blog item on the page called ‘first_post’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This page: http://blog.ostermiller.org/convert-java-outputstream-inputstream describes how to create an InputStream from OutputStream: new ByteArrayInputStream(out.toByteArray()) Other
I managed to create a simple blog and an admin page using PHP. I
I have a wordpress blog. I made a custom page-template that allows users to
Here is a link to the code about this question: http://virtual.weltec.ac.nz/s13/blog/blog.html Basically, I am
like in this post here by exemple I have found this blog but in
On my Blogger Blog I have this code in the template <b:if cond='data:blog.pageType ==
Using nanoc to create a blog archive page, I'd like to display a list
I found a JQuery Alert plugin here, http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/ So I made a sample page
here is my issue: I have a static html site and under blog I
I have this code in a xml layout file: <reference name=left> <block type=blog/blog name=left.blog.menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.