Last active
February 14, 2018 23:54
-
-
Save devuri/b19b508aa7b1f75ee9bfd845140cb1fd to your computer and use it in GitHub Desktop.
WordPress Action Hook Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://stackoverflow.com/questions/26781857/how-do-do-action-and-add-action-work | |
do_action( 'my_footer_hook' ); | |
add_action( 'my_footer_hook', 'my_footer_echo' ); | |
function my_footer_echo(){ | |
echo 'hello world'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Creating an action Hook for Worpdress | |
* call action liek so do_action( 'zipfooter_credit' ); | |
*/ | |
if ( ! function_exists( 'zipteq_footer_credit_info' ) ) : | |
function zip_footer_credit_info(){ | |
$footer_credit = '<div class="site-info">'; | |
$footer_credit .= get_bloginfo( 'name' ); | |
$footer_credit .= ' - ' .get_bloginfo( 'description' ); | |
$footer_credit .= '</div><!-- .site-info -->'; | |
echo $footer_credit; | |
} | |
endif; | |
add_action( 'zipfooter_credit', 'zip_footer_credit_info', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment