Solved

How to change the nav links below single posts to similar category posts - in WordPress.

Posted on 2011-02-15
3
476 Views
Last Modified: 2012-05-11
Hey Experts!

I need to customize a WordPress theme for one of my clients.  She wants to change up the links that are served below each post when it's pulled up in its own post page.  (within single.php)  By default, WP calls the last and next posts.  She wants it to pull 2 recent titles within the same category.  For instance, for her post at

http://www.archaeologyrevealed.com/power-of-ideology2

the two links below "People who read this article also found these articles of interest:" would be the latest posts from the category 'archaeological sites.'  (The category would vary by post.)

Here is how I have modified the code thus far:

<div id="nav-below" class="navigation">
                            <h3>Extend the Dialogue</h3>
                        <p>People who read this article also found these articles of interest: </p>
                        <ul>
                              <li class="nav-previous"><em><?php previous_post_link( '%link', '%title' ); ?></em></li>
                              <li class="nav-next"><em><?php next_post_link( '%link', '%title' ); ?></em></li>
                    </ul>
                        </div><!-- #nav-below -->

What php do I use to call the latest same category titles?

Thanks..... Tricia
0
Comment
Question by:heykevin
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 34904183
0
 

Author Comment

by:heykevin
ID: 34953867
Thanks for the link.  The php code shown on that page gave me errors, but when I drilled into another page referenced here I came up with the following modification:

 <div id="nav-below" class="navigation">
                            <h3>Extend the Dialogue</h3>
                            <p>People who read this article also found these articles of interest: </p>
                            <ul>
                              <li class="nav-previous"><em><?php previous_post_link( '%link', '%title', 'Previous in category', TRUE ); ?></em></li>
                              <li class="nav-next"><em><?php next_post_link( '%link', '%title', 'Next post in category', TRUE ); ?></em></li>
                              </ul>
                           
                            </div>

And it worked.  There is soooo much documentation out there, it can be a real challenge finding the right page.  Thanks for pointing me in the right direction.
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 34953919
Glad it worked. Cheers.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn how to dynamically set the form action using jQuery.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now