0

I am trying to hook my plugin to my custom hook in my header.php but it doesn't seem to work but if i hook to my header through the function.php everything works perfectly. Does anyone have any idea how I can get it to work.

header.php

<?php logo_hook(); ?>

function.php

function logo_hook(){
do_action('logo_hook' );
echo 'function is working';
}

logo.php //this is my plugin

add_action( 'logo_hook', 'displayLogo');
function displayLogo( $text ) {
        $logo .= 'Plugin text...';
        return $text ;
}

1 Answer 1

0

You should using do_action in your header.php

do_action( 'logo_hook' );

And adding a value on this section with below function:

function add_text() {
    echo 'Hello world!';
}
add_action( 'logo_hook', 'add_text' );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.