Skip to content Skip to sidebar Skip to footer

How To Add Wordpress Phpshortcode Into Html Page Or Custom Template?

I need to call a wordpress plugin shortcode to a different html page, this html page is not in wordpress pages or posts. I want to add the phpshortcode [

Solution 1:

You don't want to run the short code. It's really impossible because shortcodes are meant to work with the WordPress CMS. The best thing to do is the following

  1. Import the PHP file that the short code was created. Then use the function rather than the short code for the desired code within the HTML/PHP file you want.

Remember Once you leave the WordPress CMS shortcodes are virtually useless. Good luck.

Solution 2:

change the file name to .php and do <?php require( '../wp-load.php' ); // if file is in your wp-contents folder then you can call your shirtcode this way <?php echo do_shortcode('[wpdreams_ajaxsearchlite]'); ?> in your .php file.

and you cant add php in your html, you have to change file extention to .php.

<?phprequire( '../wp-load.php' );
echo do_shortcode('[wpdreams_ajaxsearchlite]');
?>

Post a Comment for "How To Add Wordpress Phpshortcode Into Html Page Or Custom Template?"