Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 is …
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

756 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