-
Notifications
You must be signed in to change notification settings - Fork 1
/
loop-mosac.php
126 lines (104 loc) · 4.12 KB
/
loop-mosac.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
// vars depending on the custom post type
if ( $band_pts[$band_count] == 'itinerario' ) {
$item_name = get_the_title();
$item_subtit = "";
$item_date_begin = "";
$item_date_end = "";
$item_icon_id = get_post_meta( $post->ID, '_quincem_icono_id',true );
if ( $item_icon_id != '' ) {
$item_icon = wp_get_attachment_image( $item_icon_id, 'icon' );
$item_icons_out = "<ul class='list-inline'><li>" .$item_icon. "</li></ul>";
} else { $item_icons_out = ""; }
if ( is_single() ) { $item_desc = get_the_content(); }
else { $item_desc = get_the_excerpt(); }
$item_img_size = "small";
$tablet_class = "4";
$desktop_class = "2";
} elseif ( $band_pts[$band_count] == 'badge' ) {
$item_name = get_the_title();
$item_subtit = get_post_meta( $post->ID, '_quincem_subtit', true );
$item_date_begin = "";
$item_date_end = "";
$item_desc = "";
$item_icons_out = "";
$item_img_size = array(75,75);
$tablet_class = "3";
$desktop_class = "2";
} elseif ( $band_pts[$band_count] == 'earner' ) {
$item_name = get_post_meta( $post->ID, '_quincem_earner_name', true );
$item_subtit = '';
$item_date_begin = "";
$item_date_end = "";
$item_desc = "";
$item_icons_out = "";
$item_img_size = array(75,75);
$tablet_class = "3";
$desktop_class = "1";
} elseif ( $band_pts[$band_count] == 'actividad' ) {
$item_name = get_the_title();
$item_subtit = get_post_meta( $post->ID, '_quincem_escenario', true );
$item_date_begin = get_post_meta( $post->ID, '_quincem_date_begin', true );
$item_date_end = get_post_meta( $post->ID, '_quincem_date_end', true );
$item_date_begin_human = date('d\/m',$item_date_begin);
$item_date_end_human = date('d\/m',$item_date_end);
if ( $item_date_begin_human == $item_date_end_human ) {
$item_date_out = $item_date_begin_human;
} else {
$item_date_out = $item_date_begin_human. "-" .$item_date_end_human;
}
$item_desc = get_the_excerpt();
$second_loop_args = array(
'post_type' => 'badge',
'meta_query' => array(
array(
'key' => '_quincem_actividades',
'value' => '"' .$post->ID. '"',
'compare' => 'LIKE'
)
)
);
$badges = get_posts($second_loop_args);
if ( count($badges) > 0 ) {
$item_icons_out = "<ul class='list-inline'>";
foreach ( $badges as $badge ) {
$badge_perma = get_permalink( $badge->ID );
$badge_tit = get_the_title( $badge->ID );
$badge_icon_id = get_post_meta( $badge->ID, '_quincem_icono_id',true );
$badge_icon = wp_get_attachment_image( $badge_icon_id, 'icon' );
$item_icons_out .= "<li><a href='" .$badge_perma. "' title='Badge: " .$badge_tit. "'>" .$badge_icon. "</a></li>";
}
$item_icons_out .= "</ul>";
} else { $item_icons_out = ""; }
$item_img_size = "small";
$pt_class = "3";
$desktop_class = "2";
}
// common vars for all custom post types
$item_perma = get_permalink();
$item_tit = "<h3 class='mosac-item-tit'><a href='" .$item_perma. "' title='" .$item_name. "' rel='bookmark'>" .$item_name. "</a></h3>";
if ( has_post_thumbnail() ) {
$item_logo = "<a href='" .$item_perma. "' title='" .$item_name. "' rel='bookmark'>" .get_the_post_thumbnail($post->ID,$item_img_size,array('class' => 'img-responsive')). "</a>"; }
else {
if ( $band_pts[$band_count] == 'earner' ) {
$item_logo = "<a href='" .$item_perma. "' title='" .$item_name. "' rel='bookmark'><img src='" .QUINCEM_BLOGTHEME. "/images/quincem-earner-avatar.png' alt='Avatar por omisión en Ciudad Escuela' class'='img-responsive' /></a>";
} else { $item_logo = ""; }
}
?>
<article class="mosac-item aligncenter col-md-<?php echo $desktop_class ?> col-sm-<?php echo $tablet_class ?>">
<div <?php post_class(); ?>>
<?php echo $item_logo; ?>
<div class="caption">
<?php echo $item_tit; ?>
<?php // subtitle
if ( $item_subtit != '' ) { echo "<div class='mosac-item-subtit'>" .$item_subtit. "</div>"; }
// date
if ( $item_date_begin != '' && $item_date_end != '' ) { echo "<div class='mosac-item-date'>" .$item_date_out. "</div>"; }
// description
if ( $item_desc != '' ) { echo "<div class='mosac-item-desc'>" .$item_desc. "</div>"; }
// icons
if ( $item_icons_out != '' ) { echo "<div class='mosac-item-icons'>" .$item_icons_out. "</div>"; }
?>
</div>
</div>
</article>