Forked from northernbellediaries/Add a post signature for multiple authors?
Last active
August 29, 2015 14:07
-
-
Save GaryJones/a5c5ea78bf4fe177ab87 to your computer and use it in GitHub Desktop.
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 | |
// Add a post signature for multiple authors. | |
// All signature divs will have a class of .signature for common styling | |
// then .signature-cat as the default and .signature-tracey for the guest | |
// as class modifiers (different background image, or background position | |
// if using sprites etc.) | |
// If it's not a single entry of any post type, return. | |
if ( is_single() ) { | |
return; | |
} | |
// Defaults for main author. | |
$class_suffix = 'tracey'; | |
$name = 'Tracey'; | |
// Cat is the guest. | |
$cat_user_id = 2; // Change this to Cat's user ID. | |
if ( get_the_author_meta( 'user_id' ) == $cat_user_id ) { | |
$class_suffix = 'cat'; | |
$name = 'Cat'; | |
} | |
// Name added for better accessibility - you can use the .signature class to | |
// implement your favourite image replacement technique. | |
?> | |
<p class="signature <?php echo sanitize_class_html( 'signature-' . $class_suffix ); ?>"><?php echo esc_html( $name ); ?></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be sure to change the guest's user ID!