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);

marked as duplicate by fuxia Aug 16 '14 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 '14 at 3:33
  • The 1st parameter is $format. You can use that for your image – Brad Dalton Aug 13 '14 at 4:03
  • If its for arrows, you could use dashicons – Brad Dalton Aug 13 '14 at 4:14

You can customize previous_post_link like this

previous_post_link('%link','<img src="link_to_image"/>');

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