WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to keep the post class not change in the loop? (2 posts)

  1. Chris
    Member
    Posted 1 year ago #

    The default post class is
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    But I want to keep the class not change in the loop,
    I mean on the homepage, I want to list 10 posts, each post has different,

    <h3>latest posts</h3>
    <article id="post-<?php the_ID(); ?>" class="post-1">

    <article id="post-<?php the_ID(); ?>" class="post-2">

    <article id="post-<?php the_ID(); ?>" class="post-3">

    <article id="post-<?php the_ID(); ?>" class="post-4">

    <article id="post-<?php the_ID(); ?>" class="post-5">

    The most recent post always has the class-1, and the previous one always has the class-2

    I don't know how to write the php, can you help me? Thank you.

  2. Chris
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic