Best way to automatically update shortcode on page when new venue is added?
-
So here is what I’m trying to figure out:
I have 13 wordpress pages each dedicated to a province in Canada. Each page displays a separate venue map for venues in that particular region.
B.C page example:
[eo_venue_map venue=”test-1,bcplace” width=”640px” height=”480px” tooltip=true]When creating a new event, you have the option to create a new venue or choose an existing one. Once the publish button has been clicked, I want it to:
Pseudocode:
1. Grab the nonce token, the state/province, and the venue id
2. Determine which province has been added, for example if its B.C then it would be ready to update this wordpress page:
https://site.com/wp-admin/post.php?post=315&action=edit
3. Generate the appropriate shortcode by either:
A.) Going through the list of all venues in B.C along with the new one, from the Database and create the shortcode:
[eo_venue_map venue=”previous-1,previous-2,newvenue” width=”640px” height=”480px” tooltip=true]
B.) Somehow grabbing the existing content in the wordpress page (perhaps from the database), parsing the shortcode, appending a comma and the venue id for the venue=”” portion of the shortcode.
4. Once the shortcode has been created, it would send a POST request to:
https://site.com/wp-admin/post.php?post=315&action=edit
And it would save the new shortcode in the content.
5. A similar process would occur for deletion or updating of a venue.
6. If there are no remaining venues in a particular region, due to deletion, for example Alberta, then the wordpress page would be updated with a simple text: “No venues available in this region”Main reason for doing this:
– A usergroup will be given permission to create new events and venues and it would be impractical to make them manually update each wordpress page with the new venue locations on the map.
– The usergroup won’t be able to see or update any wordpress pages directly, except for the events.Now I’m not asking for a full solution here with all of the code as that would probably take a lot of work. But I would appreciate tips/guidance on how to approach this problem and the best way to get it done and perhaps snippets of useful code.
Thanks! I appreciate it.
Let me know if you need any clarification on what I’m asking.https://www.ads-software.com/extend/plugins/event-organiser/
- The topic ‘Best way to automatically update shortcode on page when new venue is added?’ is closed to new replies.