Last active
January 19, 2016 05:21
-
-
Save rfmeier/5672679 to your computer and use it in GitHub Desktop.
Alter the sharedaddy box title.
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 | |
//* do not include php tags | |
add_filter( 'sharedaddy_box_title', 'custom_sharedaddy_box_title', 10, 2 ); | |
/** | |
* Callback for RFMeier-Genesis 'sharedaddy_box_title' filter. | |
* | |
* Alter the sharedaddy box title. | |
* | |
* @since 0.2 | |
* @author Ryan Meier <[email protected]> | |
* | |
* @param string $title The current sharedaddy box title | |
* @param object $post The current post object within the loop | |
* @return string $title The current sharedaddy box title | |
*/ | |
function custom_sharedaddy_box_title( $title, $post ){ | |
//* use modular arthimetic | |
$rem = $post->ID % 3; | |
//* determine the title by the remainder | |
switch ( $rem ) { | |
case 1: | |
$title = __( 'Share it! Share it good!' ); | |
break; | |
case 2: | |
$title = __( 'Share this with the world.' ); | |
break; | |
default: | |
break; | |
} | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment