-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-gallery.php
54 lines (52 loc) · 2.08 KB
/
content-gallery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
*
* content*.php
*
* The post format template. You can change the structure of your posts or add/remove post elements here.
*
* 'id' - post id
* 'class' - post class
* 'thumbnail' - post icon
* 'title' - post title
* 'before' - post header metadata
* 'content' - post content
* 'after' - post footer metadata
*
* To create a new custom post format template you must create a file "content-YourTemplateName.php"
* Then copy the contents of the existing content.php into your file and edit it the way you want.
*
* Change an existing get_template_part() function as follows:
* get_template_part('content', 'YourTemplateName');
*
*/
global $post;
theme_ob_start();
$images = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999));
if ($images) {
$total_images = count($images);
$image = array_shift($images);
$image_img_tag = wp_get_attachment_image($image->ID, 'thumbnail');
?>
<div class="gallery-thumb">
<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
</div><!-- .gallery-thumb -->
<p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, THEME_NS ),
'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', THEME_NS ), strip_tags(the_title_attribute( 'echo=0' )) ) . '" rel="bookmark"',
number_format_i18n( $total_images )
); ?></em>
</p>
<?php
}
echo theme_get_excerpt();
theme_post_wrapper(
array(
'id' => theme_get_post_id(),
'class' => theme_get_post_class(),
'title' => '<a href="' . get_permalink($post->ID) . '" rel="bookmark" title="' . strip_tags(get_the_title()) . '">' . get_the_title() . '</a>',
'heading' => theme_get_option('theme_' . (is_home() ? 'posts' : 'single') . '_article_title_tag'),
'before' => theme_get_metadata_icons('', 'header'),
'content' => theme_ob_get_clean(),
'after' => theme_get_metadata_icons('', 'footer')
)
);