Retrieve value between 2 post

Question

I have a question.

I have 2 post. post A and post B. Post B have field ID post A. I want create a function to retrieve data from post B that have the post A ID. I don’t know how to do this.

function show_post_data(){
global $post; 

$cid = $post->ID; //I create this because I want to show the Post B data in Single Post A

$my_posts = get_posts( array('post_type'=>'post_b',)); //retrive Post B data

up until here, I don’t know how to retrieve data from post B or to display it. someone help me

0
user3239674 4 years 2020-03-29T12:51:27-05:00 0 Answers 97 views 0

Leave an answer

Browse
Browse