Last active
August 29, 2015 14:11
-
-
Save danielpataki/f895f91763e6ad55ca1e to your computer and use it in GitHub Desktop.
Hooks
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
<p><?php apply_filters( 'product_display_footer', 'Thanks for using our product display plugin' ) ?></p> |
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
<h1><?php the_title() ?></h1> | |
<div class="description"><?php the_content() ?></div> | |
<?php do_action( 'below_product_description', $post ) ?> |
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
add_filter( 'login_errors', 'modify_login_errors' ); | |
function modify_login_errors() { | |
return 'Login unsuccessful, try again'; | |
} |
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
add_action( 'wp_insert_post', 'email_post_author', 10, 3 ); | |
function email_post_author( $post_id, $post, $update ) { | |
$email = 'mymail@mail.com'; | |
$subject = 'New Post Published'; | |
$message = 'A new post was published, use this link to view it: ' . get_permalink( $post->ID ); | |
wp_mail( $email, $subject, $message ); | |
} |
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
add_action( 'save_post', 'send_admin_email', 10, 3 ); | |
add_action( 'save_post', 'update_post_stats', 5, 3 ); |
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
add_action( 'wp_insert_post', 'send_author_email', 10, 3 ); | |
add_action( 'wp_insert_post', 'send_admin_email', 10, 3 ); |
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 | |
/** | |
* Plugin Name: Hook Test | |
* Description: A simple plugin to test hooks | |
*/ |
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
function wp_publish_post( $post ) { | |
// Stuff that actually published the post | |
do_action( 'wp_insert_post', $post->ID, $post, true ); | |
} |
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
if ( ! empty( $errors ) ) { | |
/** | |
* Filter the error messages displayed above the login form. | |
* | |
* @since 2.1.0 | |
* | |
* @param string $errors Login error message. | |
*/ | |
echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment