Skip Navigation

[Resolved] Display a CRED form programmatically

This support ticket is created 7 years 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by arthurR-2 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#584981

Hey guys,

I want to insert a "Post creating CRED form" programmatically in one of my template files (single-{post-type}.php). I thought I could just do

```
\do_shortcode('[cred-form form="form-slug"]');
```

When I display this form on a page through Layouts, the form is displayed with currently discussed warning "Warning: Creating default object from empty value". If I do it in template file with a shortcode like I mentioned above I just got the warning and the form is not displayed at all.

So is the form not displayed because of the warning or do I have to do something else to display the form?

And yes I really need to do it in PHP code, not with Layouts or Templates.

Thanks in advance.

Kind regards
Aleks

#585075

Dear Aleks,

Are we talking about the PHP warning message:
Creating default object from empty value in /cred/application/models/form/data.php ...

If it is, it is a known problem between the latest version of WordPress 4.8.3 and CRED plugin, our developers are working on it, I'll keep you updated here as work progresses or a patch becomes available.

#585159

Ok, I read the topic about the php warning. But nevertheless: how to insert the form in php code?

#585167

My bad, just forgot to echo the \do_shortcode('[cred-form form="form-slug"]');