WordPress.org

Ready to get started?Download WordPress

Forums

Adding a class WITHIN the previous_post function (5 posts)

  1. JamesICT
    Member
    Posted 3 years ago #

    Does anyone know of a method to add a class to the previous_post and next_post functions?

    Trying the following does not work, so if you have any ideas as to a way to do it, please share...

    <?php previous_post('&lsaquo; %', 'class="navi-prev a"', 'no', 'no'); ?>

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    can you give an example of the html output you want to achieve?

    btw: you are working with a deprecated function:
    http://codex.wordpress.org/Function_Reference/previous_post

  3. JamesICT
    Member
    Posted 3 years ago #

    Hi alchymyth,

    I am using it with css that displays the image/hover/active

    Like this...

    .navi-prev, .navi-previous, .navi-previous a {
            float: left;
            width: 360px;
    	height:168px;
    	margin: 0;
            background: url('img/nav/previous.png') no-repeat;
            border: 0;
    }
    .navi-prev:hover, .navi-previous:hover {
            background-position: -360px 0;
    }

    Actually, no, I wasn't aware that this function was deprecated - do you know if there is a current replacement and do you have any ideas as to how to go about achieving what I am after?

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    do you know if there is a current replacement

    read the link i provided - these links are not just for decoration - there is actually a lot of information in the codex.

    do you have any ideas as to how to go about achieving what I am after?

    i still don't see, where you want/need to add an extra class.
    can you give an example of the html you need for your styles?

    is your goal not achievable with styling normal a:hover ?

  5. JamesICT
    Member
    Posted 3 years ago #

    these links are not just for decoration

    Ok, ok - keep your shirt on. I missed reading that bit - my mistake.

    Not to worry now anyway - I have it sussed.

    Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic