title: Proper way to make function calls in WordPress
body: <p>What is best practice for making a function call on a wordpress page? </p>
  
  <p>For instance if you want to call <code>my_special_function();</code> on the home page, where is the proper place to put the function call (ie <code>home-page.php</code>, <code>/template-parts/content-page.php</code> etc.).</p>
  
  <pre><code>&lt;?php if( function_exists( my_special_function ) ) {
      my_special_function();
  } ?&gt;
  </code></pre>
  
  <p>FYI Im using Underscores theme.</p>
  
  <p>I've seen a few comments regarding shortcode. Would something like the below WP page template with the shortcode inserted be a best practice over just calling the function on that page?</p>
  
  <p>So if I wanted the function to be called in the page template below I would just insert the shortcode wherever I want it on that page template or just is just calling the function is sufficient or best practice</p>
  
  <pre><code>&lt;?php
  /**
   * Template Name: Home Page
   *
   * The template for displaying the home page.
   *
   * @link https://codex.wordpress.org/Template_Hierarchy
   *
   * @package Rollins_Ridge
   */
  
  get_header(); ?&gt;
  
      &lt;div id="primary" class="content-area"&gt;
          &lt;main id="main" class="site-main" role="main"&gt;
  
                  // insert Shortcode
                  &lt;?php echo do_shortcode('[special_function_shortcode]') ;?&gt;
  
                 // or just call the function
                 my_special_function();
  
                 // or something else im not aware of
                 code here;
  
              &lt;?php
              while ( have_posts() ) : the_post();
  
                  get_template_part( 'template-parts/content', 'page' );
  
                  // If comments are open or we have at least one comment, load up the comment template.
                  if ( comments_open() || get_comments_number() ) :
                      comments_template();
                  endif;
  
              endwhile; // End of the loop ?&gt;
          &lt;/main&gt;&lt;!-- #main --&gt;
      &lt;/div&gt;&lt;!-- #primary --&gt;
  &lt;?php
  get_footer();
  </code></pre>