Does hook have an effect on increasing the page load?


I have a personal website which uses WordPress.
for same changes on the theme, I can add manually codes on single.php.
Or I can write a hook for it.
for example, I want to add content on a specific single.php line.

// I made a action
function after_p(){
and then put it on single.php
             <?php after_p();?>

then I add some line and PHP files with add action on function.php

// Download Box
if (!function_exists('downloadbox')) :
        function downloadbox()
            if (function_exists('get_field'){
 add_action( 'after_p', 'tc_downloadbox' );

// adv
if (!function_exists('my_adv')) :
        function my_adv()
            echo '<div id="java-script-advs"></div>';
add_action( 'after_p', 'my_adv' );

As you guess I am a beginner I have a doubt this way is current?
I mean does use the unnecessary hook have effects on page loading?
because on my case I can simply add include('downloadbox.php') on single.php(on the line what I want). at the same for echo '<div id="java-script-advs"></div>';

D.JCode 2 months 0 Answers 9 views 0

Leave an answer