WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I am creating a website for a doctors clinic and I need some help with the code and structure. I have different service posts i.e. Dentistry, Exercise ecg and Chelation Therapy, all these posts have a category with the same name of the the post i.e. Dentistry, Exercise ecg and Chelation Therapy. I then have posts about each doctor i.e. dr joe and dr jane.

I need to link the Doctors with the services they practice so the service pages would be like this:


Dentistry is blah blah blah.

Practiced by Dr. Joe(link to dr.joe.php)

Exercise ecg.php

Exercise ecg is blah blah blah.

Practiced by Dr. Jane(link to dr.jane.php)

Chelation Therapy.php

Chelation Therapy is blah blah blah.

Practiced by Dr. Joe(link to dr.joe.php), Dr.Jane(link to dr.jane.php)

I presume it is an if statement but my PHP is pretty basic so i am not sure where to start.

Thanks for your help.

share|improve this question

The best approach here would be to add a meta box to the posts wich let's you enter additional Metadata to your posts. In this case the relevant doctors name and the link.

Refer to the codex page for the add_meta_box() function and, if that's too condensed or too little info for your liking, check out this and/or this tutorial article.

share|improve this answer

You can add the custom taxonomy that's on the services to your Doctor's posts as well. Then in your Services template, you can write a custom query that displays all doctor posts in the taxonomy assigned to the services.

Alternately, you can kind of do what @Johannes suggested, but instead of a custom metabox, look into the Advanced Custom Field plugin's relationship field or the Posts 2 Posts plugin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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