Include 3 step php form to wordpress template - wordpress

Hello i have writen 3 step multipage form in php
Files in form:
first step: start.php
second step: form.php
last step: payment.php
I wonder if there is a way to add this form in wordpress template to page.php file or something?
My form is similar to this https://www.formget.com/multi-page-form-php/

You can include external files in your site by using the Get Template Part function
Here is the function in the codex
You can use it to include any php file that you wish, see the naming convention at bottom of the codex page

So i make custom template files with something like this
<?php
/*
Template Name: OrderBM-1
*/
get_header();
include (TEMPLATEPATH . "/orderForm/start.php" );
get_footer();
?>
Files that i include, i paste in theme directory "wp-content/templates/temp-name/orderForm"

Related

WordPress Calling Function Outside

How to get value using
<?php get_theme_mods('emailaddress') ?> in file insde theme folder?
Actually I have registered a field to set email from WordPress customize section. <?php get_theme_mods('emailaddress') ?> is working fine when I display on WordPress pages or posts but it does not work when I try to get value on formhandler.php file inside theme folder.
When form is submitted, the form calls the file formhandler.php inside theme folder. So, I want to get value using <?php get_theme_mods('emailaddress') ?> to use email sent to email.
Why is <?php get_theme_mods('emailaddress') ?> not working inside formhandler.php file? This file just process the form and sends email.
Include wp-load.php at the top of formhandler.php. You will find wp-load.php in the root. If formhandler.php is on the root of your active theme then use the following include statement.
<?php include '../../../wp-load.php'; ?>

Wordpress Language file is not being loaded

I seem to have a problem loading Wordpress language files into my custom theme.
In functions.php I have the following code in my setup:
load_theme_textdomain( 'theme_textdomain', get_template_directory() . '/langs' );
In my stylesheet I have the textdomein defined:
Text Domain: theme_textdomain
In my theme folder I have a folder /langs with 2 different file types:
en_GB.mo
nl_NL.mo
Default language of my theme is nl_NL.
In one of my templates I use:
<?= __('Zoeken'); ?>
Just to test I added a translation of this in both language files:
For en_GB = search, for nl_NL = zoeken2. However, both nl_NL and en_GB are not being loaded by the theme. What I'm I doing wrong?
I think you need to specify your theme domain in your call to the __() function. I don't think it's picked up automatically from your stylesheet header. So rather than
<?= __('Zoeken'); ?>
try
<?= __('Zoeken', 'theme_textdomain'); ?>

How to add a php file to wordpress theme addition of standard files?

Wordpress themes have standard file such as header.php, footer.php, index.php, functions.php, style.css, ...
How to add a php file to wordpress theme addition of standard files? for example I want add a news.php to display specific posts in it, please help me
Just add a new file (e.g. news.php), and put the template comment at the very beginning:
<?php
/*
Template Name: News Template
*/
Then, go to your Wordpress backend, create a new page, and select the template you created:

How to include a Wordpress Shortcode in your Code, not in the Posts Section

I want to insert a hardcoded short code in my code, and not from the usual Text Editor we usually use.
Basically I want this to add a gallery, and the user doesn't need to change the shortcode from the CMS so I will be hardcoding this.
How would I need to do this, I tried to just post it in my .php file but it doesn't work.
This is the code I want to add:
[jj-ngg-jquery-slider gallery="1" width="866" height="341" ]
This will do the trick to include in .php files:
<?php echo do_shortcode('[jj-ngg-jquery-slider gallery="1" width="866" height="341"]'); ?>
shortcodes were created to include in post or pages. I could be wrong but wordpress checks the input of a post and if it finds a shortcode it will replace it with the html. I don't think it will work if you add shortcodes in your .php file because wordpress doesn't look for shortcodes in your php files
You could just create a function in functions.php to generate the html you need. Then you just call that function within your theme .php file. That's how most plugins are made. Shortcode for post & pages and function in the php files.
example:
<?php echo myGallery(array('gallery'=>1, 'width'=>866, 'height' => 341); ?>
Did you try this method ? do_shortcode($content)
I've seen it on http://codex.wordpress.org/Shortcode_API

Exclude templates in wordpress page

If I put a file up in my theme folder named foo.php that only contains <h1>Foo</h2>, WordPress will automatically pull in the home.php file.
Is there any function to prevent that and have it simply render the file foo.php. I'll still want to be able to use the wordpress functions from that page.
Thanks!
<?php
/*
Template Name: Foo
*/
?>
<h2>Foo</h2>
Saved (obviously) as 'foo.php'.
Then, when you publish a page, through the dashboard using the 'Foo' template, that template will be used.

Resources