-
-
Greetings:
I have tried to execute php code on a web page: <span style=”color: #000000; font-family: Times New Roman; font-size: medium;”>https://ezcabin.com/search-plans/ and it just echos back the code. I have two plugins installed that I have used in other themes to allow php code to be executed (1) Php Code for Posts and (2) Php Execution. </span>
Also I have created a shortcodes.php file in the specular folder and I have added the following code to the end of the functions-specular.php file:
/**
* custom php shortcodes for NEH Home Plan Search
*/
require_once(‘shortcodes.php’);Thank You
Jack
-
Hello,
We haven’t tested theme with these two plugins. As for the php code, you should add it to the functions.php file instead.
Best regards!
-
I have deactivated the two plugins (1) Php code for Posts and (2) Php Execution. Now, on the home page https://ezcabin,com I have placed <?php echo “Hello World on Home Page”?> before any other copy and when you go to https://ezcabin.com, the php code is shown and is not being ececuted.
What do I have to do to get this theme to process php code????
Thank You
-
Hello,
You can add and execute php code in all php theme files. As i previously wrote, add php code for shortcodes into functions.php file. Adding it directly to page is not the correct way.
If you must test it like this, then add the line into page.php file.Best regards!
-
I have created a shortcodes.php file in the specular theme folder and I have added the following code to the end of the functions.php file as you instructed:
/**
* custom php shortcodes for NEH Home Plan Search
*/
require_once(‘shortcodes.php’);In the shortcodes.php, I have this function:
function RetrieveSearchParameterOptions () {
…
…
…
}
add_shortcode(‘retrieve-search-parameter-options’, ‘RetrieveSearchParameterOptions’);Now, I want to execute this function on only one particular web page https://ezcabin.com/search-plans/ In other themes, I just had to place the shortcode [‘retrieve-search-parameter-options’] in the web page and it would execute the function. Or I could place <?php echo do_shortcode(‘[retrieve-search-perameter-options]’); ?> and it would execute the code.
How can I place this shortcode in the specular theme pages.php file and it execute only on the search-plan web page???
Thank You
-
Hello,
You can add new shortcode code in file \includes\register\register_shortcodes.php. Look at other existing shortcodes for example. Then add it’s file in \includes\core\shortcodes\sc folder. You’ll find it with other shortcodes in text editor. So you can use it where ever you want.
Best regards!
-
You must be logged in to reply to this topic.