1

I am kind'a new to wordpress and i need some help. I am building a website that contains articles. in each article page i want to show the writer details(image name and short description).
I have built a custom post type named 'articles', now I want to choose the writer details at the article post page lets say from a meta box...

I have also created other custom post type called 'writers' and there are all the writer details. now, my question is how do I get this done? how do I show the data from writers CPT in articles CPT?

I found this tutorial but it dosent seem to be what I need. I have installed the CPT-onomies plugin and now i see a meta box with a drop down that contains all the 'witers' CPT. how do i make the data appear in the article post front end?

Any tutorial or clue will be helpfull.

5
  • This may be helpful. wordpress.stackexchange.com/questions/110562/…
    – bdtheme
    Commented Feb 7, 2016 at 13:39
  • A quick solution is the Posts 2 Posts plugin.
    – Milo
    Commented Feb 7, 2016 at 20:09
  • p2p plugin will work but if each post has only 1 author then you can just store writer_id post meta on each article and you'll be ok running queries. another consideration might be using users and author functionality which is already built in for you. you can create users with subscriber role for example. both have pros and cons...
    – Joel M
    Commented Mar 22, 2018 at 23:18
  • The simplest solution would be to just create a custom template - within that template you could operate in a few different ways. For clarification, if you created a CPT for 'writers' am I correct in assuming that the 'writer' CPT isn't the actual 'author' of the article/post? If they are then the easier solution is to put their info in user_meta and then just pull that into a template. If I'm guessing correctly then what you want is to create an association between an entry in one CPT and another entry in another CPT. It's intricate but it's not impossible. Commented Jun 13, 2020 at 4:05
  • I have some code samples - are you working with a custom theme or a child theme? Commented Jun 13, 2020 at 4:06

2 Answers 2

0

This doesn't solve your question to show a custom post type inside a custom post type, but why don't you use an author template? You can set up users for your writers and select that user for each post. You can even use Advance Custom Fields to add custom fields to a users profile.

https://codex.wordpress.org/Author_Templates

-1

if you are not using Gutenberg in article CPT you can easily solve this problem in 5min using PIKLIST plugin. On the other hand u can also fix it by creating custom meta box where your Writer list will shown as Html Select field. Let me know if you need any further help.

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.