Advertisement
mcstevem

Untitled

Mar 27th, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. function news_byline( $byline ) {
  2. global $post;
  3.  
  4. $user_id = $post->post_author;
  5. $byline_author = get_post_meta($post->ID, 'byline-author', true);
  6. $byline_date = get_post_meta($post->ID, 'byline-date', true);
  7.  
  8. if ( function_exists( 'get_cimyFieldValue' ) ) {
  9. if ( get_cimyFieldValue( $user_id, 'UNIT' ) ){
  10. $unit = get_cimyFieldValue( $user_id, 'UNIT' );
  11. }
  12. }
  13.  
  14. $user_info = get_userdata($user_id);
  15.  
  16. if ( !empty( $user_info->user_email ) ) {
  17.  
  18. if ( function_exists( 'CoAuthorsIterator' ) ) {
  19. $i = new CoAuthorsIterator();
  20. $i->iterate();
  21. }
  22.  
  23. if ( function_exists( 'get_cimyFieldValue' ) ) {
  24. $author = '<a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author">'. get_the_author_meta( 'display_name' ) .'</a>, '. get_cimyFieldValue( get_the_author_ID(), 'UNIT' );
  25. } else {
  26. $author = '<a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author">'. get_the_author_meta( 'display_name' ) .'</a>';
  27. }
  28. if ( function_exists( 'CoAuthorsIterator' ) ) {
  29. while($i->iterate()){
  30. $author .= ', and <a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author"">'. get_the_author_meta( 'display_name' ) .'</a>, '. get_cimyFieldValue( get_the_author_ID(), 'UNIT' );
  31. }
  32. }
  33. } else {
  34. $author = '[entry-author]';
  35. }
  36.  
  37. if ( is_page() && $byline_author == 'No' && $byline_date == 'No' ) {
  38. $byline = '';
  39. } elseif ( is_page() && $byline_author == 'Yes' && $byline_date == 'No' ) {
  40. $byline = '<p class="byline">' . __( '<span class="byline-prep byline-prep-author">By</span> '. $author .' [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
  41. } elseif ( is_page() && $byline_author == 'No' && $byline_date == 'Yes' ) {
  42. $byline = '<p class="byline">' . __( 'Posted on [entry-published] [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
  43. } else {
  44. $byline = '<p class="byline">' . __( '<span class="byline-prep byline-prep-author">By</span> '. $author .' <span class="byline-prep byline-prep-published">|</span> [entry-published] [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
  45. }
  46. return $byline;
  47. }
  48.  
  49. add_shortcode( 'coauthor-link', 'news_coauthor_shortcode' );
  50.  
  51. function news_coauthor_shortcode() {
  52. echo '<span class="coauthors">';
  53. if(function_exists('coauthors_posts_links'))
  54. coauthors_posts_links();
  55. else
  56. the_author_posts_link();
  57. echo '</span>';
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement