Created
January 15, 2012 14:46
-
-
Save jcsrb/1616065 to your computer and use it in GitHub Desktop.
Wordpress Custom Class for Post
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 | |
| /* | |
| Plugin Name: Custom Post Class | |
| Description: add a custom class to your post, use 'post-class' as custom field | |
| Version: 1.0 | |
| Author: Jakob Cosoroaba | |
| Author URI: http://jakob.cosoroaba.ro/ | |
| */ | |
| function extra_post_class($classes) { | |
| global $post; | |
| $classes[] = get_post_meta($post->ID, 'post-class', true); | |
| return $classes; | |
| } | |
| add_filter('post_class', 'extra_post_class'); | |
| ?> |
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
| article.light-grey .more-link{ background-color: #eee;} | |
| article.yellow .more-link{ background-color: #fc6;} | |
| article.red .more-link{ background-color: #f66;} | |
| article.blue .more-link{ background-color: #6cf;} | |
| article.dark-grey .more-link{ background-color: #555;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

