How to correctly do a do_action/add_action and Class in PHP 5.3?
-
I think the problem is that there are too many people trying to answer a question, such as here https://wordpress.stackexchange.com/questions/48085/add-action-reference-a-class
In my case I am using a do_action in my themes template
Which is best….
class mytheme_do_header_content{ public function __construct() { add_action( 'mytheme_do_header', array( $this, 'mytheme_do_header_content_make' ) ); } function mytheme_do_header_content_make(){ //some code goes here } public function __destruct() { mytheme_do_header_content::destruct(); } } new mytheme_do_header_content();
or this
class mytheme_do_header_content{ public function __construct() { //some code goes here } public function __destruct() { mytheme_do_header_content::destruct(); } } add_action( 'mytheme_do_header', array( $this, 'mytheme_do_header_content_make' ) );
or something else
Thanks
- The topic ‘How to correctly do a do_action/add_action and Class in PHP 5.3?’ is closed to new replies.