Solved

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

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Taxonomy 2 29
Please help me find a theme close to these two themes....... 9 52
Attach to file (img) a unique id 8 27
PHP Query return divisible by 3 3 18
In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
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 viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

831 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