Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:54:13+00:00 2026-06-14T10:54:13+00:00

At the moment I have it set up so the it’s a span tag

  • 0

At the moment I have it set up so the it’s a span tag above the link that says ‘previous post’ and ‘next post’, the problem is even when there isn’t a next or previous post, the span tag stays there.

<div class="nextprev">
                    <div class="nex1">
                        <span>Previous Post</span>
                        <?php previous_post_link('<strong>%link</strong>'); ?>  
                    </div> <!-- end div nex1 -->


                    <div class="nex2">
                        <span>Next Post</span>
                        <?php next_post_link('<strong>%link</strong>'); ?> 

                    </div> <!-- end div nex1 -->
                </div> <!-- end div nextprev -->

How do I put Previous Post inside the php so it only appears when there’s a link to follow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:54:14+00:00Added an answer on June 14, 2026 at 10:54 am

    When using previous_post_link and next_post_link you can allow WordPress to control whether or not the chosen text is displayed.

    Like this:

    previous_post_link( '%link', 'Previous Post' );
    next_post_link( '%link', 'Next Post' );
    

    You can replace ‘Previous Post’ and ‘Next Post’ text with whatever you want to show up. Also, you can remove the <span> tags now. 🙂

    Edit:

    If you’d like to display the title of the post and Previous Post text, try this:

    previous_post_link( '<span>Previous Post</span>%link', '%title' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment I have a jQuery do a POST to a Controller which
At the moment I have a DocumentViewer in a WPF window that displays an
At the moment I have a combobox that is populated from the name fields
I have a Set object and I use this set to ensure that when
At the moment I have a set of divs, generated dynamically by php and
I have a set of radio buttons that triggers a jquery function if a
I basically have a script that lets users post comments but I have it
I have a bunch of div's that I have set to animate at the
I'm trying to find all records in database that have exactly the same set
I am just getting into Cocoa at the moment. I have set up Xcode

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.