Skip Navigation

[Resolved] Including toolset credform from an external php file

This support ticket is created 2 years, 4 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 6 replies, has 2 voices.

Last updated by felixP-3 2 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2407889

Tell us what you are trying to do?

I would like to create separate php files that contain one or more cred forms and include these files in my wordpress page;

for example the php file will include "<?php echo do_shortcode('[cred_form form="news-story-form-add"]'); ?>"

What do I need to do to make this work?

#2407905

Shane
Supporter

Languages: English (English )

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

Hi Felix,

Thank you for getting in touch.

This external php file is it linked to wordpress? Or is wordpress loading this file?

If this php file is not on a wordpress site then our Forms plugin won't work.
Thanks,
Shane

#2407975

The file is on the WordPress site, it is in my root directory.

I wrote my own plugin on this file and it works ( IE: echo do_shortcode('[cred_form123 default_1="ddd"]'); )

When I try to use the Toolset shortcode cred_form (IE: echo do_shortcode('[cred_form form="news-story-form-add"]');) IT DOES NOT WORK.

Do I need to include certain toolset files? (The form works fine when I include directly in my page).

FYI: I am using w3IncludeHTML(); to include the php file. Everything in the file gets executed properly except for the Toolset shortcode.

#2408015

Shane
Supporter

Languages: English (English )

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

Hi Felix,

Is there a specific reason why you are adding the file to the root directly ?

I did some checks and are you including the following lines in your custom php file ?

require( './wp-load.php' );

Thanks,
Shane

#2408053

No particular reason why it has to be in the root.

If it needs to be somewhere else, that will be ok. Let me know where.

Is there a problem with "require( './wp-load.php' );" ?

Should I be doing something else?

How can I get this done?

#2408551

Shane
Supporter

Languages: English (English )

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

Hi Felix,

Ideally I wouldn't recommend this.

You mentioned that when you created the file as a plugin, the code works. I suspect that this is because it is loading all the scripts and files that wordpress requires to work.

So if it is possible given that you've said that there isn't any particular reason for the file to be in the root then I would recommend creating your file as a plugin.

Thanks,
Shane

#2410487

My issue is resolved now. Thank you!