-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathloop-custom.php
More file actions
84 lines (61 loc) · 1.81 KB
/
Copy pathloop-custom.php
File metadata and controls
84 lines (61 loc) · 1.81 KB
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
<?php
/* ------------------------------------------------------------------------- *
* Custom Loop with WP Query
* Docs: https://codex.wordpress.org/Class_Reference/WP_Query
/* ------------------------------------------------------------------------- */
?>
<?php
/* Wp Query - page + menu order */
$custom_post = new WP_Query( array(
'post_type' => 'page',
'posts_per_page'=> 3,
'orderby' => 'menu_order',
'order' => 'ASC',
));
/* Wp Query - page + taxonomy + menu order */
// $custom_post = new WP_Query( array(
// 'post_type' => 'page',
// 'posts_per_page'=> 3,
// 'orderby' => 'menu_order',
// 'order' => 'ASC',
// 'tax_query' => array(
// array(
// 'taxonomy' => 'home_positions',
// 'field' => 'slug',
// 'terms' => 'top'
// )
// )
// ));
/* Wp Query - post + taxonomy */
// $custom_post = new WP_Query( array(
// 'post_type' => 'post',
// 'tax_query' => array(
// array(
// 'taxonomy' => 'people',
// 'field' => 'slug',
// 'terms' => 'bob',
// )
// )
// ));
/* Wp Query - post + category */
// $custom_post = new WP_Query( array(
// 'post_type' => 'post',
// 'category_name' => 'news',
// 'posts_per_page'=> 3,
// ));
/* Wp Query - sub pages + menu order */
// $this_page_id = $wp_query->post->ID;
// $custom_post = new WP_Query( array(
// 'post_type' => 'page',
// 'post_parent' => $this_page_id,
// 'posts_per_page' => 100,
// 'orderby' => 'menu_order',
// 'order' => 'ASC',
// ));
?>
<?php if ($custom_post->have_posts()) : while($custom_post->have_posts()) : $custom_post->the_post(); ?>
<?php the_post_thumbnail('thumbnail', array('class' => '','alt' => get_the_title())); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php wp_reset_postdata(); ?>
<?php endwhile; endif; ?>