Custom post types php function
-
Hello,
First of all, thank you for this great plugin!
We have developed a website that organises events for a remembrance in the Netherlands. There are over 120 events that need to be exported including their locations, in 1 export file. These are 2 different post types but I was able to do this by wp_query:
'post_type' => array('event','location'), 'post_status'=>'publish'
However, I cannot get the events and locations together in a single <post>, the events and locations are seperate and I have been scratching my head to get this to work. I believe this can be achieved by custom PHP function but for some reason I am probably missing something obvious. I hope you can assist me.
The data is stored in 2 different database tables, for the events this is table em_events and for the locations this is em_locations. What I need is the info from the events and some of the info from the locations but in one single <post>
This is what I get (I have shortened it a bit):
For the events:
<post>
<id>2722</id><post_type>event</post_type>
<_event_id>167</_event_id>
<_location_id>58</_location_id>
<_location_country></_location_country>
<_location_region></_location_region>
<_location_postcode></_location_postcode>
<_location_state></_location_state>
<_location_town></_location_town>
<_location_address></_location_address>
<_location_latitude></_location_latitude>
<_location_longitude></_location_longitude>
</post>For the location:
<post>
<id>1534</id>
<_location_id>58</_location_id>
<_location_country>NL</_location_country>
<_location_region></_location_region>
<_location_postcode>6811BP</_location_postcode>
<_location_state>Gelderland</_location_state>
<_location_town>Arnhem</_location_town>
<_location_address>Velperbinnensingel 15</_location_address>
<_location_latitude>51.9827007</_location_latitude>
<_location_longitude>5.9134642</_location_longitude>
</post>All the info from the location is being exported fine but I need that info to be put in the event post above.
Is this even possible and can you give me a small push in the right direction?
Thank you and have a great weekend,
Marieke
- The topic ‘Custom post types php function’ is closed to new replies.