Last active
December 20, 2015 12:49
-
-
Save brandondove/6134031 to your computer and use it in GitHub Desktop.
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_filter( 'the_content', 'custom_before_content' ); | |
function custom_before_content ( $content = '' ) { | |
// Just drop in content in the your_text variable. It can be html or plain | |
$category = get_the_category(); | |
switch( $category[0]->cat_name ) { | |
case 'Category 1' : | |
$your_text = 'Category 1'; | |
default : | |
$your_text = 'Default'; | |
} | |
return $your_text.$content; | |
} | |
add_filter( 'the_content', 'custom_after_content' ); | |
function custom_after_content ( $content = '' ) { | |
$category = get_the_category(); | |
switch( $category[0]->cat_name ) { | |
case 'Category 1' : | |
$your_text = 'Category 1'; | |
default : | |
$your_text = 'Default'; | |
} | |
return $content.$your_text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment