Skip Navigation

[Resolved] Add code to types

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Waqas 5 years, 6 months ago.

Assigned support staff: Waqas.

Author
Posts
#279530

Hello,

I would like to link the creation of a type 'pledge' (post extended) with that of a map marker using MapMarkers.

1) When I create a pledge, I also create a marker, get the ID of the marker in return and save it in the 'pledge' type for future use (update)
2) When I update a pledge, I use the marker ID to post the updated information in the marker using an API.

The information on the MapMarker API is at: hidden link.

To add a new marker, title Headquarter, geocode Main Street 1 Washington, it can be either:

<em><u>hidden link</u></em> Street 1 Washington

or:

<form action="<em><u>hidden link</u></em>" method="POST">
<input type="hidden" name="key" value="YOUR_PUBLIC_KEY"/>
<input type="hidden" name="signature" value="YOUR_SIGNATURE"/>
<input type="hidden" name="expires" value="YOUR_EXPIRE_VALUE"/>
<input type="text" name="action" value="add"/>
<input type="text" name="type" value="marker"/>
<input type="text" name="markername" value="Headquarters"/>
<input type="text" name="geocode" value="Main Street 1 Washington"/>
<input type="submit" name="submit" value="submit"/>
</form>

My question is: where do I put that code? Same question for an update (for either the http request or the form)?
I don't see any custom field where I can write a form or execute a http request (using the values of the 'pledge' fields to fill in).

And of course, I would like to be able to set the ID of the new pledge after the marker has been created... If there is already a simple solution without getting back the ID, that would be a great first step.

Subsidiary question: what piece of code/condition should I use to differentiate the behaviour between new 'pledge' (to create a marker) and existing (update)? I suppose that at their creation custom fields are empty.

Thank you in advance

Serge

#279838

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Actually, Types doesn't offer such solution, except creating Custom Post Types and Custom Fields, which you can use to create/edit/manage via CRED (forms), Views (listing/display/query) or by using Custom Coding (WP standards).

I think the solution you are asking for, does require custom coding involved. You will need to create marker handling via custom coding and upon success, you will need to create/update your particular CPT using WP methods.

Please have a look at:
- http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
- http://codex.wordpress.org/Function_Reference/wp_update_post
- http://codex.wordpress.org/Function_Reference/add_post_meta
- http://codex.wordpress.org/Function_Reference/update_post_meta