WordPress.org

Make WordPress Core

Ticket #30846: demo-page.php

File demo-page.php, 1.0 KB (added by philbirnie, 6 years ago)

Demo page template containing query with tagin.

Line 
1<?php
2/**
3 * The template for displaying pages
4 *
5 * This is the template that displays all pages by default.
6 * Please note that this is the WordPress construct of pages and that
7 * other "pages" on your WordPress site will use a different template.
8 *
9 * @package WordPress
10 * @subpackage Twenty_Fifteen
11 * @since Twenty Fifteen 1.0
12 *
13 * Template Name: Phil Tag Demo
14 */
15
16get_header(); ?>
17
18        <div id="primary" class="content-area">
19                <main id="main" class="site-main" role="main">
20
21                <?php
22                //5 - C (0 Posts)
23                //4 - B (2 Posts)
24                //3 - A (1 Post)
25
26                $queryArgs = array(
27                        'fields' => 'ids',
28                        'tag__in' => array(5,4,3)
29                );
30
31                $query = new WP_Query($queryArgs);
32
33                var_dump('=======  $query->get_posts(); =========');
34                var_dump($query->get_posts());
35
36                var_dump('=======  $query->query_vars; =========');
37                var_dump($query->query_vars);
38
39        var_dump('=======  $query->request; =========');
40        var_dump($query->request);
41                ?>
42
43                </main><!-- .site-main -->
44        </div><!-- .content-area -->
45
46<?php get_footer(); ?>