Basically I am coding my own theme, and I would like to have my titles listed on the left hand side, so that on clicking the title, the corresponding body opens up on the right. How can I list these two interlinked items separate from each other, but still have the title reference the right post. The problem I'm anticipating is that I might have to construct a different loop for the titles section and the body section each. Once I've done this, I don't see how I can link them together so that the jQuery I use would link the title to the corresponding body.

Much thanks in advance

  • Need more info. Are you coding a new theme or you are one of those default theme. Surely its not a problem if you know some php and wordpress coding..
    – Sisir
    May 18, 2012 at 8:26
  • It is a new theme I am coding. I have just made the edit to the question. I know PHP and wordpress coding, but the solution to my question still eludes me.
    – Seedorf
    May 18, 2012 at 8:46

1 Answer 1


Here is an idea:

  1. Use get_posts() to get posts you want.
  2. On the right hand side show titles via foreach.
  3. use setup_postdata() on right hand side loop to get post content.
  4. You can use jquery tabs to show and hide post content or just use jquery.
  5. Don't do get_posts() twice or use ajax because you already got contents when you did get_posts() on no. 1

How do you relate contents:

So you have content of same posts on two part of the page. How do you relate them to use on jquery. Well, you can use post id off course. Check for same id on the content area if id matches with title show the content.

<h1 id="post_<?php the_ID(); ?>><?php the_title(); ?></h1>

<div id="post_content_<?php the_ID(); ?>>the_content();</div>
  • Glad it worked! :)
    – Sisir
    Jul 20, 2012 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.