-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.php
111 lines (99 loc) · 2.86 KB
/
queries.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
<?php
function query_destacados() {
wp_reset_postdata();
$args = array(
'post_type' => 'post', // if the post type is post
'posts_per_page' => 2,
'post_status' => 'publish',
'cat' => get_cat_ID('destacados'),
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array(
'post-format-gallery',
'post-format-video',
),
'operator' => 'NOT IN'
)
)
);
return new WP_Query($args);
}
function query_principal() {
wp_reset_postdata();
$excluidos = get_category_by_slug('excluir-home');
$excludeCategory = array( $excluidos->term_id , get_cat_ID('destacados') );
$args = array(
'post_type' => 'post', // if the post type is post
'posts_per_page' => 18,
'post_status' => 'publish',
'category__not_in' => $excludeCategory,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array(
'post-format-gallery',
'post-format-video',
),
'operator' => 'NOT IN'
)
)
);
return new WP_Query($args);
}
function query_by_cat($cat) {
wp_reset_postdata();
$args = array(
'post_type' => 'post',
'posts_per_page' => 2,
'post_status' => 'publish',
'cat' => $cat,
);
return new WP_Query($args);
}
function query_videos() {
wp_reset_postdata();
// Traer los posts formateados como video
// y en la categoria destacados (18)
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
'post_status' => 'publish',
'cat' => '18',
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array(
'post-format-video'
),
'operator' => 'IN'
)
)
);
return new WP_Query($args);
}
function query_galeria() {
wp_reset_postdata();
// Traer los posts formateados como galeria
$args = array(
'post_type' => 'galeria',
'posts_per_page' => 12,
'post_status' => 'publish'
);
return new WP_Query($args);
}
function query_programacion() {
wp_reset_postdata();
$args = array(
'post_type' => 'programas',
'posts_per_page' => -1,
'post_status' => 'publish',
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => 'horario_inicio'
);
return new WP_Query($args);
}