-
-
Save wpsmith/3383854 to your computer and use it in GitHub Desktop.
Add "Email Us" link to footer
This file contains hidden or 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 | |
/** | |
* Add "Email Us" link to footer | |
* | |
* @author Bill Erickson | |
* @author Travis Smith (modified) | |
* @link http://www.billerickson.net/overriding-options-and-meta | |
*/ | |
function be_email_us() { | |
echo '<p><a href="mailto:' . htmlentities( get_option( 'admin_email' ) ) . '">Email Us</a></p>'; | |
} | |
add_action( 'wp_footer', 'be_email_us' ); | |
/** | |
* Modify Author Email option on Single Posts | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/overriding-options-and-meta | |
* | |
* @param string $email | |
* @return string | |
*/ | |
function be_post_author_email( $email ) { | |
global $post; | |
if( is_single() ) | |
$email = get_the_author_meta( 'user_email', $post->post_author ); | |
return $email; | |
} | |
add_filter( 'pre_option_admin_email', 'be_post_author_email' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment