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 7965429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:09:11+00:00 2026-06-04T06:09:11+00:00

I have built a WP Loop that is limited to 2 articles that it

  • 0

I have built a WP Loop that is limited to “2” articles that it loads. What I’d like to do is the second article in the loop or the bottom one, Not have a border-bottom on it.

How can I do this in the WP Loop?

My PHP Code is :

<div class="span content"> <!-- This is column 1 -->
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
            <h2><?php the_title(); ?></h2>
            <p class=""<?php the_content(); ?>
   <?php endwhile; ?>
</div><!-- /.span8 .content -->

CSS for that is :

.article {
border-bottom: 1px dotted #000000;
width: 170px;
}

Thanks

  • 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-04T06:09:12+00:00Added an answer on June 4, 2026 at 6:09 am

    Just do it with simple CSS. Should work down to IE7.

    .article {
        width: 170px;
    }
    
    .article:first-child {
        border-bottom: 1px dotted #000000;
    }
    

    Note: The :first-child implemtation in IE7 is a bit buggy if your first-child is a text-node like a comment.

    :first-child will match Item 1

    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
    </ul>
    

    :first-child does not match Item 1 because the comment.

    <ul>
        <!-- Comment -->
        <li>Item 1</li>
        <li>Item 2</li>
    </ul>
    

    Workarround

    <ul><!-- Comment --><li>Item 1</li>
        <li>Item 2</li>
    </ul>
    

    or just strip the comment.

    You could also count your iteration in the while-loop. Thats not an elegant Method but should work for you…

    <?php
        //Set Counter to 0
        $counter = 0;
    
        // Start Loop
        if ( have_posts() ) while ( have_posts() ) : the_post();
    
        // Increment Coounter
        $counter++;
    ?>
        <div class="span content item-<?php echo $counter; ?>">
            <h2><?php the_title(); ?></h2>
            <p><?php the_content(); ?></p>
        </div><!-- /.span8 .content -->
    <?php endwhile; ?>
    

    Each iteration of your WP-Loop will increment the $counter by 1.

    First Iteration:

     <div class="span content item-1">
    

    Second Iteration:

     <div class="span content item-2">
    

    Third Iteration:

     <div class="span content item-3">
    

    … and so on.

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

Sidebar

Related Questions

I have a variable that is built in loop. Something like: $str = ;
I have built a loop that finds all of the VMDKs for a perticular
I have a list that is built like this: <ul id=ajaxList class=ajaxListUL> and then,
can't find an answer to this one... I have a form that detects changed
I have built UI, its like a search engine for BioProcess/Disease--> Genes. e.g., User
We have built a web application that accepts SOAP messages, does some processing, calls
I have built an app that plays lots of sounds the easy way: AudioServicesPlaySystemSound(someSoundID);
I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND
Good evening I have a JTable that I built with a TableModel how to
I have a 3rd-party protocol module (SNMP) that is built on top of asyncore.

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.