Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action(
- 'jnews_single_post_before_title',
- function ( $post_id ) {
- if ( function_exists( 'jnews_get_primary_category' ) ) {
- $cat_id = jnews_get_primary_category( $post_id );
- $category = '';
- if ( $cat_id ) {
- $category = get_category( $cat_id );
- if ( $category && ( isset( $category->slug ) && isset( $category->name ) ) ) {
- $class = 'class="category-' . $category->slug . '"';
- $category = '<div class="custom-category-badge"><a href="' . get_category_link( $cat_id ) . "\" {$class}>" . $category->name . '</a></div>';
- }
- echo $category;
- }
- }
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment