-
Notifications
You must be signed in to change notification settings - Fork 0
/
services.php
54 lines (42 loc) · 1.09 KB
/
services.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
/*
Template Name: Services
@package wordpress
*/
echo get_the_content();
echo "Get the post title alphabetically: ";
echo do_shortcode('[alphabatically-post]');
$service_meta_query_args = [
[
'key' => 'feature',
'value' => 1,
'type' => 'numeric'
]
];
$service_tax_query_args = [
[
'taxonomy' => 'service_cat',
'field' => 'slug',
'terms' => 'health'
]
];
/*
* Get the service which are feature service and taxonomy is health
*/
$get_service_args = [
'post_type' => 'service',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => $service_tax_query_args,
'meta_query' => $service_meta_query_args
];
$get_service_query = new WP_Query($get_service_args);
echo "Get the service post type which are the featured service and taxonomy is health:";
if ($get_service_query->have_posts()) {
while ($get_service_query->have_posts()) {
$get_service_query->the_post();
echo "<h3>". get_the_title() ."</h3>";
}
}
wp_reset_postdata();
?>