post_author, $args['authorPrecededBy'] ); } if($args['showCategories'] === $position_field) { $text[] = self::getPostCategories( $post->ID, $post->post_type, $args['categoriesPrecededBy'] ); } if(!empty($text)) { $text = '

' . implode('
', $text) . '

'; if($position === 'above') $content = $text . $content; else if($position === 'below') $content .= $text; } } return $content; } private static function getPostCategories($post_id, $post_type, $preceded_by) { $preceded_by = trim($preceded_by); // Get categories $categories = wp_get_post_terms( $post_id, get_object_taxonomies($post_type), array('fields' => 'names') ); if(!empty($categories)) { // check if the user specified a label to be displayed before the author's name if(strlen($preceded_by) > 0) { $content = stripslashes($preceded_by) . ' '; } else { $content = ''; } return $content . join(', ', $categories); } else { return ''; } } private static function getPostAuthor($author_id, $preceded_by) { $author_name = get_the_author_meta('display_name', (int)$author_id); $preceded_by = trim($preceded_by); if(strlen($preceded_by) > 0) { $author_name = stripslashes($preceded_by) . ' ' . $author_name; } return $author_name; } }