Solved

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

Posted on 2011-02-15
3
484 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

615 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