add_action in wp_head accessible from class

Given this code:

class test_class {

function greeting() {
echo ‘Howdy! Test is successful!’;
}

function greeting_head() {
//Close PHP tags
?>
<?php greeting() ?>
<?php //Open PHP tags
}
}

add_action( ‘wp_head’, array( ‘test_class’, ‘greeting_head’ ) );

greeting() is undefined. How to access if from outside test_class?

Read more here:: add_action in wp_head accessible from class

Leave a Reply

Your email address will not be published. Required fields are marked *