I wrote a shortcode that is used for displaying data and it is used just in one page (ie: PAGEX using full-width-page-template.php). The shortcode function is very huge.
function rj_mysh_shortcode() {
// Lots of lines of business logic
}
add_shortcode('rj_mysh', 'rj_mysh_shortcode');
Every time a webpage is called I think functions.php is called and parsed by PHP. I'm looking for a solution in order to avoid to spend time in parsing something not useful.
I thought that I can create a template TEMPLATE_PAGEX and move the function there.
TEMPLATE_PAGEX.php:
<?php
function rj_mysh_shortcode_template() {
// Lots of lines of business logic
}
include(locate_template('full-width-page-template.php'));
?>
At the end the shortcode is:
function rj_mysh_shortcode() {
return rj_mysh_shortcode_template()
}
add_shortcode('rj_mysh', 'rj_mysh_shortcode');
Is this the right solution?
Rr