vendredi 27 novembre 2015

wp_head and wp_footer hook not working

I have make one custom theme options plugin and following code put in plugin file

add_action( 'init', 'test_head_footer_init' );
function test_head_footer_init() {
    add_action( 'wp_head', 'childtheme_favicon'); 
    add_action( 'wp_footer', 'childtheme_analytics');
}

function childtheme_favicon() {
        $shortname =  get_option('of_shortname'); 
        if (get_option($shortname . '_custom_favicon') != '') {
            echo '<link rel="shortcut icon" href="'.  get_option($shortname .'_custom_favicon')  .'"/>'."\n";
        }
}

function childtheme_analytics(){
    $shortname =  get_option('of_shortname');
    $output = get_option($shortname . '_google_analytics');
    if ( $output <> "" ) 
        echo stripslashes($output) . "\n";
}   

When i have run my code and check in home url page head tag nothing is print. same in footer.

Can you please guide me what i have mistake..

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire