Skip Navigation

[Resolved] Load custom CSS and Javascript for CRED Form

This support ticket is created 5 years, 11 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.

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, 11 months ago.

Assisted by: Shane.

Author
Posts
#1231031

Dear Sir/Madam,

I have custom CSS and Javascript to be loaded for CRED Form, I know there is the editor for putting the CSS and Javascript but I don't know how I can load external CSS or Javascript, so I check the page-id and load the script from functions.php

If Form type is "Add new content", I can check the page-id by using get_the_ID() and then add the script or stylesheet using wp_enqueue_script() or wp_enqueue_style(), how about if Form Type is "Edit existing content", how can I add the external CSS/Javascript to it?

Best regards,

Kelvin.

#1231137

Shane
Supporter

Languages: English (English )

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

Hi Kelvin,

Thank you for getting in touch.

You should be able to get the page id by doing this.

$id = get_the_ID();

Then you can use an if statement if for the ID if it matches the page you want the script to be loaded on.

Please let me know if this helps.
Thanks,
Shane

#1231246

Dear Shane,

Sorry I think you misunderstand my question, I know the get_the_ID(), my question is how I can load the custom CSS and Javascript for the Form Type is "Edit existing content", like hidden link;, there is no page-id can be checked.

Best regards,

Kelvin.

#1231621

Shane
Supporter

Languages: English (English )

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

Hi Kelvin,

I see what you mean now.

In this case you can do $_GET['layout_id']

Since the ID of the layout is provided in the URL then you can use this to check and from there you can load your script based on the matching condition.

So The if statement would look like this.

if(isset($_GET['layout_id'])){
  if($_GET['layout_id'] == 6799){
//do something
}

}

Please let me know if this helps.
Thanks,
Shane