Skip Navigation

[Resolved] Ok the API is great but where should we use it ?

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 5 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#1246091

Hi

We wrote you several times since we are heavy users of Joomla/seblod CCKs and the WP/Toolset logic is very different.

Here I can't understand where I should write code for custom PHP using the CRED API (for example)

On https://toolset.com/documentation/programmer-reference/cred-api/ we see code examples but where should we write it ?

the same question occurs on views API.

And if I want to add custom PHP code to the view of a custom post, where should I write ite please ?

Thanks for your help

Cyril

#1246143

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cyril,

Normally we would add the custom code in the Toolset custom code section in Toolset-> Settings -> Custom code.

"And if I want to add custom PHP code to the view of a custom post, where should I write ite please ?" The custom code will be added in the same custom code section.

However could you let me know what kind of custom code will this be for the view ?

Thanks,
Shane

#1246287

Thanks

so the code should not be written in the functions.php file ?

as for the custom code we whish to write for the view here are some examples :

- there is a hidden custom field that contains a value and we need to make a href link upon a visible field with the value of the hidden field
- depending on the value of a custom field we show or hide another field
- depending on the value of a custom field we compute a SQL query, take the return values and display them in the view

Thanks

cyril

#1246583

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Cyril,

"So the code should not be written in the functions.php file ?"

You can write it here however having your custom code not in the theme file would be ideal since you can retain the functionality even if you switch the theme.

-depending on the value of a custom field we compute a SQL query, take the return values and display them in the view

This you would probably need to construct a custom shortcode to achieve but its definitely possible.

Thanks,
Shane