Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to make the previous and next post link into an image instead of a link text e.g.

<a href="%link"><img src=""  /> </a>

so whatever the size of the image it would be clickable i tried adding a css through filter but the image just stays as a background(not clickable)

function post_left_attributes($output) {
    $injection = 'class="arrow_left"';

    return str_replace('<a href=', '<a '.$injection.' href=', $output);
}

function post_right_attributes($output) {
    $injection = 'class="arrow_right"';
    return str_replace('<a href=', '<a '.$injection.' href=', $output);
}
share|improve this question

marked as duplicate by toscho Aug 16 at 1:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
they are different (not looking for featured image but make the next and previous into image only ) –  JPL Aug 13 at 3:33
    
The 1st parameter is $format. You can use that for your image –  Brad Dalton Aug 13 at 4:03
    
If its for arrows, you could use dashicons –  Brad Dalton Aug 13 at 4:14

1 Answer 1

You can customize previous_post_link like this

previous_post_link('%link','<img src="link_to_image"/>');
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.