Advertisement
Guest User

wp_get_attachment_image_src

a guest
Apr 24th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | None | 0 0
  1. <?php
  2. $template = get_post_meta( get_the_ID(), 'wpzoom_post_template', true );
  3. $is_recipe = in_category('Resep');
  4. if ($template == 'full') {
  5. $media_width = 980;$media_height = 554;$size = "post-full";}
  6. else {
  7. $media_width = 638;$media_height = 270;$size = "photo";}
  8. ?>
  9. <?php get_header(); ?>
  10.  
  11. <div id="content-wrap"<?php
  12. if ($template == 'side-left') { echo " class=\"side-left\""; }
  13. if ($template == 'full') { echo " class=\"full-width\""; }
  14. ?>>
  15. <div id="content">
  16. <div class="post_content">
  17. <?php wp_reset_query(); if (have_posts()) : while (have_posts()) : the_post(); ?>
  18. <div id="post-<?php the_ID(); ?>" class="clearfix">
  19. <?php if ($is_recipe) {echo '<div class="hrecipe">';}
  20. $attachment_id = get_post_thumbnail_id( $post_id ); $image_attributes = wp_get_attachment_image_src( $attachment_id, full );
  21. if ( ( $is_recipe && ( $image_attributes[1] >= 600)) ) {
  22. get_the_image( array( 'size' => $size, 'width' => $media_width, 'height' => $media_height, 'before' => '<div class="post-thumb">', 'after' => '<p>'.get_post(get_post_thumbnail_id())->post_excerpt.'</p></div>', 'link_to_post' => false ) );
  23. }
  24. if ($is_recipe) {
  25. ?>
  26. <h1 class="entry-title fn pf-title"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">Resep <?php the_title(); ?></a></h1>
  27. <?php } else { ?>
  28. <h1 class="entry-title fn pf-title"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
  29. <?php } ?>
  30. $foto = $image_attributes[0]; ?>
  31. <div class="entry entry-content <?php if ($image_attributes[1] < 600) { echo 'ouder'; } if (!$is_recipe) {echo ' non-resep';} ?>">
  32. <?php if ($image_attributes[1] < 600 ) { ?>
  33. <img class="photo" src="<?php echo $foto; ?>" width="240px" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
  34. <?php } else {}?>
  35. <span class="clear"></span>
  36. <?php the_content(); ?>
  37. <div class="cleaner">&nbsp;</div>
  38. </div>
  39. <!-- / .entry -->
  40. <?php if ($is_recipe) {echo '</div> <!-- / .hrecipe -->';} ?>
  41. </div>
  42. <!-- #post-<?php the_ID(); ?> -->
  43. <?php
  44. endwhile; else: ?>
  45. <p>
  46. <?php _e('Sorry, no posts matched your criteria', 'wpzoom');?>
  47. .</p>
  48. <?php endif; ?>
  49. <div class="cleaner">&nbsp;</div>
  50. </div>
  51. <!-- / .post_content -->
  52. </div>
  53. <!-- / #content -->
  54. <?php if ($template != 'full') { get_sidebar(); } ?>
  55. <div class="cleaner">&nbsp;</div>
  56. </div>
  57. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement