Forums

[resolved] X under 1st post, Y under the rest (3 posts)

  1. chris2006
    Member
    Posted 1 year ago #

    Hello,
    I'm sure this is really simple but im pretty crap trying to figure out the php if else code.

    Basically i want a specific unique sentence of text to be displayed under the first wordpress post on index.php

    And for all the other posts on the index.php to have the same text underneath them.

    Example:

    First Post Title on Index.php
    <blog text>
    Why not subscribe to our RSS feed?

    ---------------------

    All Other Post Titles on Index.php
    <blog text>
    Some boring text for all other entries

  2. adamrbrown
    Member
    Posted 1 year ago #

    You can apply the principles in this tutorial:

    http://adambrown.info/b/widgets/easy-php-tutorial-for-wordpress-users/first-post-different-from-the-rest/

    At the top of your loop:

    <?php $firstPost = 'Why not subscribe blah blah'; ?>

    Where you like, but probably near the end of your loop:

    <?php echo $firstPost; ?>

    And right after that:

    <?php $firstPost = 'Some boring text'; ?>

  3. chris2006
    Member
    Posted 1 year ago #

    Great, thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.