Title: Adding a class WITHIN the previous_post function
Last modified: August 19, 2016

---

# Adding a class WITHIN the previous_post function

 *  [jamesict](https://wordpress.org/support/users/jamesict/)
 * (@jamesict)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/)
 * 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'); ?>`

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/#post-2041140)
 * 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](http://codex.wordpress.org/Function_Reference/previous_post)
 *  Thread Starter [jamesict](https://wordpress.org/support/users/jamesict/)
 * (@jamesict)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/#post-2041141)
 * 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?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/#post-2041143)
 * > 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 ?
 *  Thread Starter [jamesict](https://wordpress.org/support/users/jamesict/)
 * (@jamesict)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/#post-2041147)
 * > 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 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding a class WITHIN the previous_post function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [jamesict](https://wordpress.org/support/users/jamesict/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/adding-a-class-within-the-previous_post-function/#post-2041147)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
