How can I call a WordPress shortcode within a template?

There's a plugin for the Contact us form.

To activate the form, all you have to do is to place [CONTACT-US-FORM] in the page...

My page is calling a page template. Is it possible to add the [CONTACT-US-FORM] shortcode in the PHP template?

I tried it and it did not work.

The WordPress page worked, but not the method I want.


PHP Contact Us template I want to try something like this, but it did not work.

Template Name: [contact us]

get_header(); ?>
<?php get_footer(); ?>


Try this:

Template Name: [contact us]

echo do_shortcode('[CONTACT-US-FORM]'); 
echo do_shortcode('[CONTACT-US-FORM]');

Use this in your template.

Look here for more: Do Shortcode

Make sure to enable the use of shortcodes in text widgets.

// To enable the use, add this in your *functions.php* file:
add_filter( 'widget_text', 'do_shortcode' );

// and then you can use it in any PHP file:  
<?php echo do_shortcode('[YOUR-SHORTCODE-NAME/TAG]'); ?>

Check the documentation for more.

Tags: PHP / Css / Wordpress

Similar questions

call widget from within shortcode
I have a shortcode in my functions.php which runs a query on a category. I want to have a twitter feed on this particular page. I have a javscript option working on my page for twitter right now but it doesn't look good and will take way to long to edit the javascript ( in minified format ) to make it look good, so I thought I would use a plugin. I...
Call Shortcode Attribute Value within another function
Please anyone with an idea of how I can extract some values of this shortcode attributes and use it within another function. How the code looks like: } Then I will like to call the $outvalue variable within another function. The issue is that the $outvalue is not displaying anything, please guys help I don't know what am doing wrong, I also learnt ...
Can you call a template file without assigning template to a page in the admin panel?
This idea is just to protect certain sections of my theme from over-zealous clients. I would like to add pages, that exist in the front end and can be added to the menu (using wordpress 3.0 api) but the page NOT be present in the 'Pages' dialogue in the admin panel, and is thus not user editable.
How to call template within plugin folder?
I want to call/load template file inside plugin folder. Any suggestion. Thanks.
WordPress, Parse Shortcode within Shortcode
I'm working on a site for a client that runs a social ransom style blog. This is where the user has to click one of the social media buttons to get access to the content. However, she is now going to use the OnePress Social Locker Plugin for wordpress which works by wrapping the content in specific tags, like so: At the moment she already has her o...
WordPress Parse Shortcode Within a Shortcode
I have a shortcode ( outputURL ) that is used to output a value into a URL. The value is retrieved from a shortcode ( valueURL ). The valueURL output is text wrapped in a div: I need only the textForURL value, excluding the div tags. Thus far, I have only been able to output the div tags and text but not the clean version of just text. Here is my s...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.