Created
December 17, 2013 21:03
-
-
Save jawinn/8012560 to your computer and use it in GitHub Desktop.
Snazzy Layout 3 (old)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="sz_cont <?php echo ( ( $post->post_type=='page' ) ? "sz_page" : "sz_post" ) ?>" > | |
<a class="sz_title" href="<?php echo $url ?>"><?php echo $title ?></a> | |
<?php // GET THE FIRST IMAGE ATTACHMENT ?> | |
<?php | |
$args = array( | |
'numberposts' => 1, | |
'order'=> 'ASC', | |
'post_mime_type' => 'image', | |
'post_parent' => $post->ID, | |
'post_status' => null, | |
'post_type' => 'attachment' | |
); | |
$attachments = get_children( $args ); | |
if ($attachments) { | |
foreach($attachments as $attachment) { | |
if ( wp_get_attachment_image_src( $attachment->ID, 'thumbnail' ) ) { | |
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' ); | |
} else { | |
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' ); | |
} | |
} | |
} | |
?> | |
<?php // IMAGE IN POST: image url found in the post content (original default functionality) ?> | |
<?php $imageurl = $this->getImageUrl($imageurl, 110); ?> | |
<?php if ($attachments) : ?> | |
<a class="snazzy-image" href="<?php echo $url; ?>"> | |
<div class="sz_img" style="background: transparent url('<?php echo wp_get_attachment_thumb_url( $attachment->ID ); ?>') no-repeat center;" ></div> | |
</a> | |
<div class="sz_excerpt"><?php echo ($comcount ? "<strong>$comcount comments</strong>" : "") ?></div> | |
<?php elseif ($imageurl) : ?> | |
<a class="snazzy-image" href="<?php echo $url; ?>"> | |
<div class="sz_img" style="background: transparent url('<?php echo $imageurl ?>') no-repeat center;" ></div> | |
</a> | |
<div class="sz_excerpt"><?php echo ($comcount ? "<strong>$comcount comments</strong>" : "") ?></div> | |
<?php elseif ($excerpt) : ?> | |
<div class="sz_excerpt">“<?php echo $excerpt ?>” <?php echo ($comcount ? "<br/><strong>$comcount comments</strong>" : "") ?></div> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment