Mugan Posted March 9, 2020 Share Posted March 9, 2020 Hi, I have a series of post to post connections. In one function, the output is a list of the linked post to posts. Here is an example: function countryJob(){ global $post; $echo = f_print(array( 'data' => 'p2p', 'type' => 'ul', 'args' => array( 'connection_type' => 'job_to_location', 'post_type' => 'job', 'connection_id' => $post->ID, 'alternative' => '', ), )); echo '<div class="country-job-text">'.$echo.'</div>'; job, location and city are all post types that can be connected. I want to create the same as above to create a list of the cites connected to a location (locations are the name for posts which are countries) How do I discover the connection type and post type needed to create this output? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 (edited) NO idea what you are asking. What is 'post to post'? Never heard of that term unless you mean you are building an actual fence. Edited March 9, 2020 by ginerjm Quote Link to comment Share on other sites More sharing options...
Mugan Posted March 9, 2020 Author Share Posted March 9, 2020 well, the above function finds a list of all jobs connected to a location. it then creates that list as an echo. I need to do the same with the cities connected to a location. So I need to change the 'connection_type' and 'post_type' args, and while that seems straightforward, it doesnt produce a result. I was wondering if connection_type or post_type needed to be specified elsewhere before they are named in this section of the code in order to pull the list of connected cities. I'm very new, so any help understanding this is very useful. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 YOu need to write a query connecting different things - is that what you are saying? A new table that has cities in it and you want to join that to you jobs table? Quote Link to comment Share on other sites More sharing options...
Mugan Posted March 9, 2020 Author Share Posted March 9, 2020 (edited) the connections are specified in the wordpress backend, so all countries have a section in the backend that lets you choose which 'city' posts are connected to them. What I then need to do is display these cities using a function that is looking up the country post you are on, and displays a list of the connected cities. Sorry, I am very new to these types of function writing, and trying to understand some old code at the same time, so appreciate the help in understanding it. Edited March 9, 2020 by Mugan Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 And I don't do wordpress so I'm not only unable to help, I don't know what you want. Quote Link to comment Share on other sites More sharing options...
Mugan Posted March 9, 2020 Author Share Posted March 9, 2020 ok, well thanks anyway. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.