How to call shortcode in non-wordpress pages?

admin

Administrator
Staff member
I'm currently working (on my localhost) on a new wordpress page which uses various shortcodes from a plugin. When I create a page within the wordpress dashboard and insert a shortcode in the HTML edit it works fine.

However, I have now created a new page from scratch (home.php), which I want to use as my start page and I want to call one of the shortcodes and it doesnt work. When I insert just the shortcode in html [the_shortcode] the file just returns this as text output. When I use

Code:
<?php echo do_shortcode(‘[the_shortcode]’); ?>

the page show not output.

I'm fairly new to shortcodes, so I'm not sure what I'm doing wrong. Does the file perhaps need to sit in a specific folder to be able to call shortcodes or needs some importing of files?

With regards to folder locations I have tried both:

Code:
C:\MAMP\htdocs\newwordpresspage
C:\MAMP\htdocs\newwordpresspage\wp-content\themes\newtheme

and then called the file via my localhost address.

Could anyone please help how to successfully call the shortcodes?

Code:
<?php 
define( 'WP_USE_THEMES', false ); 
require( './wp-load.php' );
echo do_shortcode('[gd_advanced_search]'); 
?>