Guest User

Untitled

a guest
Mar 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  4.  
  5. <div class="eachpost ">
  6. <div>
  7. <?php the_title(); ?>
  8. </div>
  9. </div>
  10.  
  11. <?php
  12. $content = get_the_content($more_link_text, $stripteaser, $more_file);
  13. $content = apply_filters('the_content', $content);
  14. $content = preg_replace('/<img[^>]+./','', $content);
  15. $content = str_replace('<p>','',$content);
  16. $content = str_replace('</p>','<br /><br />',$content);
  17. $content = str_replace('<div class="eachpost "><div></div></div>','',$content);
  18. $content = str_replace('<div class="eachpost twocols"><div></div></div>','',$content);
  19. $content = str_replace('<div class="eachpost threecols"><div></div></div>','',$content);
  20. $content = str_replace(']]>', ']]>', $content);
  21. ?>
  22. <div class="eachpost twocols">
  23. <div>
  24. <?php echo $content; ?>
  25. </div>
  26. </div>
  27.  
  28. <div class="main">
  29. <?php
  30. $imgcontent = get_the_content($more_link_text, $stripteaser, $more_file);
  31. $imgcontent = apply_filters('the_content', $imgcontent);
  32. $imgcontent = preg_replace('/<p[^>]+./','', $imgcontent);
  33. $imgcontent = str_replace('<p>','',$imgcontent);
  34. $imgcontent = str_replace('</p>','',$imgcontent);
  35.  
  36. if ( strstr($imgcontent,'<div class="eachpost')) {
  37. echo $imgcontent;
  38. } else {
  39.  
  40. // gallery not found;
  41.  
  42. $images = explode("<img ", $imgcontent);
  43. if (count($images) != "1") {
  44. for ($i=0;$i<count($images);$i++) {
  45.  
  46. if ($images[$i] != "") {
  47. $image = str_replace('<img ','<div class="eachpost "><div><img ','<img '.$images[$i]);
  48. $imagepieces = explode("/>", $image);
  49. $imageurl = substr($imagepieces[0], 0, -2) . '" /></div></div>';
  50.  
  51. $imagesrc_temp = explode('src="', $imageurl);
  52. $imagesrc = explode('"', $imagesrc_temp[1]); // get src
  53.  
  54. $imagew_temp = explode('width="', $imageurl);
  55. $imagew = explode('"', $imagew_temp[1]); // get width
  56.  
  57. $imageh_temp = explode('height="', $imageurl);
  58. $imageh = explode('"', $imageh_temp[1]); // get height
  59.  
  60. $upload_path = get_option( 'upload_path' );
  61. $upload_path = trim($upload_path);
  62. $img_full_url = $imagesrc[0];
  63.  
  64. $temp = substr(strrchr($upload_path, "/"), 1);
  65.  
  66. list($url, $filename) = explode($temp, $img_full_url);
  67.  
  68. $img_url = $upload_path . "/" . $filename;
  69.  
  70. $imagesize = getimagesize($img_url);
  71. list($width, $height, $type, $attr) = getimagesize($img_url);
  72. $theClass = "eachpost ";
  73. if ( $width < "440" ) { $new_width = "200"; $theClass = "eachpost "; }
  74. else if ( $width < "660" ) { $new_width = "430"; $theClass = "eachpost twocols"; }
  75. else { $new_width = "660"; $theClass = "eachpost threecols"; }
  76.  
  77. $new_height = ($height*$new_width)/$width;
  78.  
  79. echo '<div class="'.$theClass.'">
  80. <div>';
  81.  
  82. echo '<img src="' . $img_full_url . '" width="' . $new_width . '" height="' . $new_height . '" /></div></div>'; }
  83.  
  84.  
  85. }
  86. }
  87. }
  88. ?>
  89. </div>
  90.  
  91.  
  92. <div class="eachpost twocols">
  93. <div>
  94. <?php if ( comments_open() ) comments_template(); ?>
  95. </div>
  96. </div>
  97.  
  98. <?php endwhile; else: ?>
  99. <div class="warning">
  100. <p>Sorry, but you are looking for something that isn't here.</p>
  101. </div>
  102. <?php endif; ?>
  103.  
  104. <div class="navigation_group">
  105. <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
  106. <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
  107. </div>
  108.  
  109. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment