Move Thematic Post Thumbnail Outside of Entry-content


/ Published in: PHP
Save to your folder(s)

This is some code using Thematic Child Theme overrides to remove thematic's post thumbnails and add Post Thumbnails outside of the .entry-content so that POst Thumbnails can be styled separated from all post Meta. See this page for an example www.speiranconsulting.com/blog


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. // Override to remove Thematic's Post Thumbnails
  4.  
  5. function childtheme_override_content(){
  6. global $thematic_content_length;
  7.  
  8. if ( strtolower($thematic_content_length) == 'full' ) {
  9. $post = get_the_content( thematic_more_text() );
  10. $post = apply_filters('the_content', $post);
  11. $post = str_replace(']]>', ']]&gt;', $post);
  12. } elseif ( strtolower($thematic_content_length) == 'excerpt') {
  13. $post = '';
  14. $post .= get_the_excerpt();
  15. $post = apply_filters('the_excerpt',$post);
  16. } elseif ( strtolower($thematic_content_length) == 'none') {
  17. } else {
  18. $post = get_the_content( thematic_more_text() );
  19. $post = apply_filters('the_content', $post);
  20. $post = str_replace(']]>', ']]&gt;', $post);
  21. }
  22. echo apply_filters('thematic_post', $post);
  23. }
  24.  
  25.  
  26. // Override to add Post Thumbnails in their own DIV and open a new .post-body DIV
  27.  
  28. function childtheme_override_postheader() {
  29. global $post;
  30.  
  31. if ( is_404() || $post->post_type == 'page') {
  32. $postheader = thematic_postheader_posttitle();
  33. }
  34. elseif ( has_post_thumbnail() && is_home()) {
  35. $permalink = get_permalink($id);?>
  36. <div class="post-thumb"> <a class="entry-thumb" href="<?php echo $permalink; ?>">
  37. <?php $postheader = the_post_thumbnail(array(200, 200)); ?>
  38. </a></div><div class="post-body">
  39. <?php
  40. $postheader .= thematic_postheader_posttitle() . thematic_postheader_postmeta();
  41. }
  42. else {
  43. $postheader = thematic_postheader_posttitle() . thematic_postheader_postmeta();
  44. }
  45.  
  46. echo apply_filters( 'thematic_postheader', $postheader ); // Filter to override default post header
  47. }
  48.  
  49. // Override to add in Closing div for .post-body
  50.  
  51. function childtheme_override_postfooter() {
  52. $post_type = get_post_type();
  53. $post_type_obj = get_post_type_object($post_type);
  54.  
  55. // Check for "Page" post-type and logged in user to show edit link
  56. if ( $post_type == 'page' && current_user_can('edit_posts') ) {
  57. $postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink();
  58. $postfooter .= "</div><!-- .entry-utility -->\n";
  59. // Display nothing for logged out users on a "Page" post-type
  60. } elseif ( $post_type == 'page' ) {
  61. $postfooter = '';
  62. // For post-types other than "Pages" press on
  63. } else {
  64. $postfooter = '<div class="entry-utility">';
  65. if ( is_single() ) {
  66. $post_type_archive_link = ( function_exists( 'get_post_type_archive_link' ) ? get_post_type_archive_link( $post_type ) : home_url( '/?post_type=' . $post_type ) );
  67. if ( thematic_is_custom_post_type() && $post_type_obj->has_archive ) {
  68. $postfooter .= __('Browse the ', 'thematic') . '<a href="' . $post_type_archive_link . '" title="' . __('Permalink to ', 'thematic') . $post_type_obj->labels->singular_name . __(' Archive', 'thematic') . '">';
  69. $postfooter .= $post_type_obj->labels->singular_name . '</a>' . __(' archive', 'thematic') . '. ';
  70. }
  71. $postfooter .= thematic_postfooter_posttax();
  72. } elseif ( post_type_supports( $post_type, 'comments') ) {
  73. $postfooter .= thematic_postfooter_posttax();
  74. $postfooter .= thematic_postfooter_postcomments();
  75. }
  76. // Display edit link
  77. if (current_user_can('edit_posts')) {
  78. if ( !is_single() && post_type_supports( $post_type, 'comments') ) {
  79. $postfooter .= "\n\n\t\t\t\t\t\t" . '<span class="meta-sep meta-sep-edit">|</span> ';
  80. }
  81. $postfooter .= ' ' . thematic_postfooter_posteditlink();
  82. }
  83. $postfooter .= "\n\n\t\t\t\t\t</div><!-- .entry-utility -->\n";
  84. if (is_home() && has_post_thumbnail()) {
  85. $postfooter .= '</div><!--.post-body-->';
  86. }
  87. }
  88. // Put it on the screen
  89. echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer
  90. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.