WordPress.org

Ready to get started?Download WordPress

Forums

Custom previous and next posts (1 post)

  1. CtiaKitahara
    Member
    Posted 6 years ago #

    Hi everyone,

    I've got a similar issue as the one related here. I'm trying to use an image as my next/previous links as well, but in the navigation between the index pages, like the home , categories and archive results.

    I was using:

    <?php next_posts_link('<img src="myImg.png" />') ?>
    <?php previous_posts_link('<img src="myImg.png" />') ?>

    But I need to pass a class and a title to the <a>, so I tried this:

    <a class="myClass" href="<?php next_posts(); ?>" title="myTitle"><img src="myImg.png" /></a>
    <a class="myClass" href="<?php previous_posts(); ?>" title="myTitle"><img src="myImg.png" /></a>

    However, the link shows all the time, even when there's no previous or next page.

    I'm quite sure it's not very difficult to solve, maybe a little bit of code, but I'm no php dev.

    could somebody help me, please?

    thanks,
    Cátia

Topic Closed

This topic has been closed to new replies.

About this Topic