Categories : PHP , Wordpress

If you dont want to code you can install this ready to use wp edit header and footer plugin.

Hi, when you develop a plugin or theme. You will need to add come codes to header or footer section. With this action hook “wp_head” you can add any php , css , js code to your header in your plugin or theme.

<?php

add_action('wp_head', 'gc_add_header_code');
function gc_add_header_code() {

    // your codes

}

Be carefull when you add js or css code because you need to close php tags first.

You can use this example when you add css or js codes.

<?php

add_action('wp_head', 'gc_add_header_code');
function gc_add_header_code() {
    ?>

    <style>
        
    </style>



    <script>
    
    </script>

    <?php
}

Leave a Reply

Your email address will not be published.