Solved

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

Posted on 2011-02-15
3
477 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing variables to stored procedure 3 35
File submission to SQL Server 1 38
PHPStorm debugging issues 1 21
html input type 3 21
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

914 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

19 Experts available now in Live!

Get 1:1 Help Now