1) I'm not able to integrate the form in a PHP template file, that's the code:
<?php echo do_shortcode('[Chronoforms6 chronoform="search"]') ?>The shortcode [Chronoforms6 chronoform="search"] works great only in pages and articles.
2) In the load section i set a PHP action to include a custom PHP file. The problem here is that I can't access the $this->data object in the included file because I get the following error:
PHP Fatal error: Using $this when not in object contextTo be noted that the same form, works great in Joomla where I can use the $this->data without problem also in the included PHP file.
I include the PHP file the same way as I included it in Joomla (except that 'JPATH_ROOT' was replaced with 'site_url()') with:
include_once(site_url() . '/myfolder/myfile.php');
Thanks.
<?php echo do_shortcode('[contact-form-7 id="12" title="Contact form"]'); ?>Take a look at wordpress code reference here https://developer.wordpress.org/reference/functions/do_shortcode/
include ABSPATH . "wp-content/plugins/chronoforms6/chronoforms6.php";
echo do_shortcode('[Chronoforms6 chronoform="search"]');But I get the following error:
Fatal error: Cannot declare class Chronoforms6, because the name is already in use in C:\xampp\htdocs\wordpress\wp-content\plugins\chronoforms6\chronoforms6.php on line 12
if(!class_exists("Chronoforms6")){//include line here}
<?php
if(!class_exists("Chronoforms6")) {
include ABSPATH . "wp-content/plugins/chronoforms6/chronoforms6.php";
echo "INCLUDED";
} else {
echo "NOT INCLUDED";
}
echo do_shortcode('[Chronoforms6 chronoform="search"]');
?>
add_shortcode('Chronoforms6',array(new Chronoforms6(),'cf6_getform'));
add_shortcode('Chronoforms6',array(new Chronoforms6(),'cf6_getform'));[/blockquote]
Not work.
Also, why do not you just place the form inside a page/post then call that post in your template ? does that work ?
I'm pretty new to WP so I don't know how to properly include a page/post in theme template. Anyway I have inserted the CFV6 Shortcode [Chronoforms6 chronoform="search"] in an article and here the form is displayed right.[br][br]When I try to show that article in my theme, I can see only the text of the article "Welcome to WordPress. This is your first post...", but not the form. I use the following code:
$post = get_post( 1 ); -->> HELLO WORLD with Chronoforms6 ShortCodeIn the print_r($post) I can see in 'post_content' the Chronoforms6 shortocode, but is not displayed in the view
print_r($post);
$output = apply_filters( 'the_content', $post->post_content );
echo $output;
There are other posts for that issue:
- http://www.chronoengine.com/forums/posts/t107789/wordpress-choronoforms-v6-shortcode-works-in-pages-not-widgets
- http://www.chronoengine.com/forums/posts/t108139/chronoforms6-not-display-forms-on-wordpress
Maybe CFV7 solve that problem? I trie to download the V. 7 RC1 from the download section but I get the error "File does not exist."
if(class_exists('Chronoforms7')){
$Chronoforms6 = new Chronoforms6();
echo $Chronoforms6->cf6_render(['chronoform' => 'test-form'];
}by the way, I'm testing using the default twentynineteen theme on WP, which file you are modifying for testing ?
I'm working on Flatsome theme and I'm modifying a file used to display WooCommerce categories, called 'category-off-canvas.php'.
Any way, thank you soo much for your support. I'm really excited to try the new CFV7 version.
the new v7 for WP is already available for download on the downloads page if you want to try it, you can use the same code above but change all the "6" to "7", I would love to hear your thoughts when you try it!
