-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplates.php
70 lines (53 loc) · 1.66 KB
/
templates.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/*
*
* Template for the thumbnails
*
*/
function sthlm_img_thumb_template($img){
// get the thumbnail
$src = wp_get_attachment_image_src($img->ID, 'thumbnail'); // The img
?>
<div class="sthlm-thumb sthlm-thumb-<?php echo $img->ID; ?>" data-thumb-id="<?php echo $img->ID; ?>">
<div class="remove-sthlm-thumb"></div>
<img src="<?php echo $src[0]; ?>" alt="<?php echo esc_attr($img->post_title); ?>" />
<!-- Edit thumb -->
<a class="sthlm-edit-thumb-info" href="#sthlm-edit-thumb-info"><?php _e('Redigera', 'sthlm_gallery'); ?></a>
<?php sthlm_img_thumb_data_template($img); ?>
</div>
<?php
}
// template for the img info
function sthlm_img_thumb_data_template($img){ ?>
<div class="sthlm-thumb-data">
<?php
// TAGS
$tags = wp_get_object_terms($img->ID, 'img_cat');
$num = count($tags);
$tagsOut = array();
if(!empty($tags)): foreach($tags as $t):
$tagsOut[] = $t->name;
endforeach; endif;
$tagsOut = implode(',', $tagsOut);
?>
<div class="sthlm-thumb-id"><?php echo $img->ID; ?></div>
<div class="sthlm-thumb-title"><?php echo $img->post_title; ?></div>
<div class="sthlm-thumb-excerpt"><?php echo $img->post_excerpt; ?></div>
<div class="sthlm-thumb-content"><?php echo $img->post_content; ?></div>
<div class="sthlm-thumb-tags"><?php echo $tagsOut; ?></div>
</div>
<?php
}
/*
*
* Template for the gallery
*
*/
function sthlm_gallery_template($id, $title){ ?>
<div class="sthlm-gallery" data-gallery-id="<?php echo $id; ?>" >
<div class="remove-sthlm-gallery"></div>
<div class="sthlm-gallery-title"><?php echo $title; ?></div>
<?php echo get_the_post_thumbnail($id, 'thumbnail'); ?>
</div>
<?php
}