Created
September 19, 2010 00:56
-
-
Save thefrosty/586232 to your computer and use it in GitHub Desktop.
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
If there is more than one attachment, add a second shortcode parameter: | |
<?php | |
if ( in_category( 'photo' ) ) { | |
do_shortcode( '[gallery numberposts="1" columns="1" link="attachment"]' ); | |
//http://wordpress.org/support/topic/if-postpage-has-more-than-one-attachment | |
$args = array( | |
'post_type' => 'attachment', | |
'numberposts' => -1, | |
'post_status' => null, | |
'post_parent' => $post->ID, | |
'post_mime_type' => 'image' | |
); | |
$attachments = get_posts($args); | |
if ($attachments) { | |
$c = 0; | |
foreach ($attachments as $attachment) { | |
if ( wp_attachment_is_image( $attachment->ID ) ) $c++; | |
} | |
if ( $c > 1 ) { | |
do_shortcode( '[gallery numberposts="9" columns="3" offset="1" size="thumbnail"]' ); | |
} | |
} | |
} else { | |
the_content('<p class="serif">Read the rest of this entry »</p>'); | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forgot the echo's before the "do_shortcode".