mangomatic_postheader

The MangoMatic (Responsive) mangomatic postheader function.

Description

mangomatic_postheader(); 

Usage

  1. if ( !function_exists( 'mangomatic_postheader' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = mangomatic_postheader(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function mangomatic_postheader() { 
  2. global $id, $post, $authordata; 
  3. // Create edit link 
  4. $posteditlink .= '<div class="entry-edit-link">'; 
  5. $posteditlink .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id; 
  6. $posteditlink .= '" title="' . __('Edit post', 'mangomatic') .'">'; 
  7. $posteditlink .= __('Edit', 'mangomatic') . '</a>'; 
  8. $posteditlink .= '</div>'; 
  9. $posteditlink = apply_filters('thematic_postheader_posteditlink', $posteditlink);  
  10.  
  11. // start parent div 
  12. $parent_div_start = '<div id="list-item">'; 
  13. $parent_div_end = '</div>'; 
  14.  
  15. // create date block 
  16. $postdate = '<div class="entry-date-block">'; 
  17. $postdate .= '<div class="entry-month">' . get_the_date('M') . '</div>'; 
  18. $postdate .= '<div class="entry-day">' . get_the_date('m') . '</div>'; 
  19. $postdate .= '<div class="entry-year">' . substr(get_the_date('Y'), 0, 2) . '<br />' . get_the_date('y') . '</div>'; 
  20. $postdate .= '</div>'; 
  21. //create author block 
  22. if( !is_search() && !is_archive() ) { 
  23. $postauthor = '<div class="entry-author-block">'; 
  24. $postauthor.= '<div class="entry-author-avatar">'. get_avatar( $authordata->user_email, 44 ) .'</div>'; 
  25. $postauthor.= '<div class="entry-author-name">by <a class="url fn n" href="'; 
  26. $postauthor.= get_author_link(false, $authordata->ID, $authordata->user_nicename); 
  27. $postauthor.= '" title="' . __('View all posts by ', 'mangomatic') . get_the_author() . '">'; 
  28. $postauthor.= get_the_author(); 
  29. $postauthor.= '</a></div>'; 
  30. $postauthor.= '</div> <!-- end .entry-author-block -->'; 
  31. } else { 
  32. $postauthor = '<div class="entry-author-name">by <a class="url fn n" href="'; 
  33. $postauthor.= get_author_link(false, $authordata->ID, $authordata->user_nicename); 
  34. $postauthor.= '" title="' . __('View all posts by ', 'mangomatic') . get_the_author() . '">'; 
  35. $postauthor.= get_the_author(); 
  36. $postauthor.= '</a></div>'; 
  37.  
  38. // populate post meta block  
  39. $postmeta_div = '<div id="post-meta">'; 
  40. $postmeta_div.= $postdate; 
  41. $postmeta_div.= $postauthor; 
  42. if (current_user_can('edit_posts')) { 
  43. $postmeta_div.= $posteditlink; 
  44. $postmeta_div.= '</div>'; 
  45.  
  46. if (is_single() || is_home()) { 
  47. $postheader .= mangomatic_postheader_posttitle() . $postmeta_div; 
  48. } elseif(is_page()) { 
  49. $postheader .= mangomatic_postheader_posttitle(); 
  50. } elseif (is_404()) {  
  51. $postheader = '<h1 class="entry-title">' . __('Not Found', 'mangomatic') . '</h1>'; 
  52. } elseif( is_archive() ) { 
  53. $postheader .= '<div id="entry-list-archive-header">' . $postdate . $parent_div_start . mangomatic_postheader_posttitle() . $postauthor .$parent_div_end . '</div>'; 
  54. } elseif( is_search() ) { 
  55. $postheader .= '<div id="entry-list-search-header">' . mangomatic_postheader_posttitle() . '</div>'; 
  56.  
  57. return $postheader;