wp/wp-includes/query.php
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:40:08 +0200
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
permissions -rw-r--r--
Add CLAUDE.md documentation and sync WordPress core files - Add comprehensive CLAUDE.md documentation file with project architecture, development setup, database operations, WordPress CLI usage, file sync procedures, and Mercurial commands - Update WordPress core files from wordpress/ to wp/ directory - Sync latest WordPress admin interface, includes, and core functionality - Update plugins: portfolio plugin with latest BWS framework and fancybox integration - Maintain custom configuration and theme files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * WordPress Query API
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * The query API attempts to get which part of WordPress the user is on. It
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * also provides functionality for getting URL query information.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
     8
 * @link https://developer.wordpress.org/themes/basics/the-loop/ More information on The Loop.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * @subpackage Query
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
/**
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    15
 * Retrieves the value of a query variable in the WP_Query class.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 * @since 1.5.0
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    18
 * @since 3.9.0 The `$default_value` argument was introduced.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    19
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    20
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    22
 * @param string $query_var     The variable key to retrieve.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    23
 * @param mixed  $default_value Optional. Value to return if the query variable is not set.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    24
 *                              Default empty string.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    25
 * @return mixed Contents of the query variable.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    27
function get_query_var( $query_var, $default_value = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    29
	return $wp_query->get( $query_var, $default_value );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
/**
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    33
 * Retrieves the currently queried object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    35
 * Wrapper for WP_Query::get_queried_object().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    39
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    40
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    41
 * @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
function get_queried_object() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
	return $wp_query->get_queried_object();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
/**
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    49
 * Retrieves the ID of the currently queried object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    51
 * Wrapper for WP_Query::get_queried_object_id().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    55
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    56
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    57
 * @return int ID of the queried object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
function get_queried_object_id() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	return $wp_query->get_queried_object_id();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
/**
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    65
 * Sets the value of a query variable in the WP_Query class.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
 * @since 2.2.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    68
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    69
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    71
 * @param string $query_var Query variable key.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    72
 * @param mixed  $value     Query variable value.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    74
function set_query_var( $query_var, $value ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    76
	$wp_query->set( $query_var, $value );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    80
 * Sets up The Loop with query parameters.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    82
 * Note: This function will completely override the main query and isn't intended for use
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    83
 * by plugins or themes. Its overly-simplistic approach to modifying the main query can be
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    84
 * problematic and should be avoided wherever possible. In most cases, there are better,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    85
 * more performant options for modifying the main query such as via the {@see 'pre_get_posts'}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    86
 * action within WP_Query.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    87
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    88
 * This must not be used within the WordPress Loop.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    91
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    92
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    94
 * @param array|string $query Array or string of WP_Query arguments.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    95
 * @return WP_Post[]|int[] Array of post objects or post IDs.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    97
function query_posts( $query ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
	$GLOBALS['wp_query'] = new WP_Query();
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    99
	return $GLOBALS['wp_query']->query( $query );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   103
 * Destroys the previous query and sets up a new query.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   105
 * This should be used after query_posts() and before another query_posts().
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   106
 * This will remove obscure bugs that occur when the previous WP_Query object
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   107
 * is not destroyed properly before another is set up.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
 * @since 2.3.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   110
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   111
 * @global WP_Query $wp_query     WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   112
 * @global WP_Query $wp_the_query Copy of the global WP_Query instance created during wp_reset_query().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
function wp_reset_query() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
	$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
	wp_reset_postdata();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
 * After looping through a separate query, this function restores
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
 * the $post global to the current post in the main query.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
 * @since 3.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   124
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   125
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
function wp_reset_postdata() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
	global $wp_query;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   129
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   130
	if ( isset( $wp_query ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   131
		$wp_query->reset_postdata();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   132
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
 * Query type checks.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   140
 * Determines whether the query is for an existing archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   142
 * Archive pages include category, tag, author, date, custom post type,
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   143
 * and custom taxonomy based archives.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   145
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   146
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   147
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   148
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   150
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   151
 * @see is_category()
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   152
 * @see is_tag()
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   153
 * @see is_author()
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   154
 * @see is_date()
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   155
 * @see is_post_type_archive()
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   156
 * @see is_tax()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   157
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   159
 * @return bool Whether the query is for an existing archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
function is_archive() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   165
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	return $wp_query->is_archive();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   173
 * Determines whether the query is for an existing post type archive page.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   174
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   175
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   176
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   177
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   181
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   182
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   183
 * @param string|string[] $post_types Optional. Post type or array of posts types
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   184
 *                                    to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   185
 * @return bool Whether the query is for an existing post type archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
function is_post_type_archive( $post_types = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   191
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
	return $wp_query->is_post_type_archive( $post_types );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   199
 * Determines whether the query is for an existing attachment page.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   200
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   201
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   202
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   203
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
 * @since 2.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   206
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   207
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   209
 * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   210
 *                                              to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   211
 * @return bool Whether the query is for an existing attachment page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   213
function is_attachment( $attachment = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   217
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   221
	return $wp_query->is_attachment( $attachment );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   225
 * Determines whether the query is for an existing author archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
 * If the $author parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
 * check if the query is for one of the authors specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   230
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   231
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   232
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   233
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   235
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   236
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   238
 * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   239
 *                                          to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   240
 * @return bool Whether the query is for an existing author archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
function is_author( $author = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   246
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
	return $wp_query->is_author( $author );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   254
 * Determines whether the query is for an existing category archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
 * If the $category parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
 * check if the query is for one of the categories specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   259
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   260
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   261
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   262
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   264
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   265
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   267
 * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   268
 *                                            to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   269
 * @return bool Whether the query is for an existing category archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
function is_category( $category = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   275
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
	return $wp_query->is_category( $category );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   283
 * Determines whether the query is for an existing tag archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
 * If the $tag parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
 * check if the query is for one of the tags specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   288
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   289
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   290
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   291
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
 * @since 2.3.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   293
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   294
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   296
 * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   297
 *                                       to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   298
 * @return bool Whether the query is for an existing tag archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
function is_tag( $tag = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   304
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
	return $wp_query->is_tag( $tag );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   312
 * Determines whether the query is for an existing custom taxonomy archive page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
 * If the $taxonomy parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
 * check if the query is for that specific $taxonomy.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
 * If the $term parameter is specified in addition to the $taxonomy parameter,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
 * this function will additionally check if the query is for one of the terms
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
 * specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   321
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   322
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   323
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   324
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
 * @since 2.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   326
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   327
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   329
 * @param string|string[]           $taxonomy Optional. Taxonomy slug or slugs to check against.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   330
 *                                            Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   331
 * @param int|string|int[]|string[] $term     Optional. Term ID, name, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   332
 *                                            to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   333
 * @return bool Whether the query is for an existing custom taxonomy archive page.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   334
 *              True for custom taxonomy archive pages, false for built-in taxonomies
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   335
 *              (category and tag archives).
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
function is_tax( $taxonomy = '', $term = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   341
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
	return $wp_query->is_tax( $taxonomy, $term );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   349
 * Determines whether the query is for an existing date archive.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   350
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   351
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   352
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   353
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   356
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   357
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   359
 * @return bool Whether the query is for an existing date archive.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
function is_date() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   365
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
	return $wp_query->is_date();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   370
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   373
 * Determines whether the query is for an existing day archive.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   374
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   375
 * A conditional check to test whether the page is a date-based archive page displaying posts for the current day.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   376
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   377
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   378
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   379
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   381
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   382
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   383
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   385
 * @return bool Whether the query is for an existing day archive.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
function is_day() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   390
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   391
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   393
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
	return $wp_query->is_day();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   399
 * Determines whether the query is for a feed.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   400
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   401
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   402
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   403
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   404
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   405
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   406
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   407
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   408
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   409
 * @param string|string[] $feeds Optional. Feed type or array of feed types
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   410
 *                                         to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   411
 * @return bool Whether the query is for a feed.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
function is_feed( $feeds = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   417
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
	return $wp_query->is_feed( $feeds );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   423
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   424
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   425
 * Is the query for a comments feed?
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   427
 * @since 3.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   428
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   429
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   430
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   431
 * @return bool Whether the query is for a comments feed.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
function is_comment_feed() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   434
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   435
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   436
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   437
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   438
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   439
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   440
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   441
	return $wp_query->is_comment_feed();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   445
 * Determines whether the query is for the front page of the site.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   447
 * This is for what is displayed at your site's main URL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   448
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   449
 * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
 * If you set a static page for the front page of your site, this function will return
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   452
 * true when viewing that page.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   454
 * Otherwise the same as {@see is_home()}.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   456
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   457
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   458
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   459
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
 * @since 2.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   461
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   462
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   463
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   464
 * @return bool Whether the query is for the front page of the site.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   465
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
function is_front_page() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   468
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   469
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   470
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   471
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   472
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   473
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   474
	return $wp_query->is_front_page();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   475
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   476
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   477
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   478
 * Determines whether the query is for the blog homepage.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   479
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   480
 * The blog homepage is the page that shows the time-based blog content of the site.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   481
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   482
 * is_home() is dependent on the site's "Front page displays" Reading Settings 'show_on_front'
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   483
 * and 'page_for_posts'.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   484
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   485
 * If a static page is set for the front page of the site, this function will return true only
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   486
 * on the page you set as the "Posts page".
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   487
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   488
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   489
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   490
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   491
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   492
 * @since 1.5.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   493
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   494
 * @see is_front_page()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   495
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   496
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   497
 * @return bool Whether the query is for the blog homepage.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   498
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   499
function is_home() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   500
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   501
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   503
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   504
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
	return $wp_query->is_home();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   508
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   511
 * Determines whether the query is for the Privacy Policy page.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   512
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   513
 * The Privacy Policy page is the page that shows the Privacy Policy content of the site.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   514
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   515
 * is_privacy_policy() is dependent on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   516
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   517
 * This function will return true only on the page you set as the "Privacy Policy page".
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   518
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   519
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   520
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   521
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   522
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   523
 * @since 5.2.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   524
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   525
 * @global WP_Query $wp_query WordPress Query object.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   526
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   527
 * @return bool Whether the query is for the Privacy Policy page.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   528
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   529
function is_privacy_policy() {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   530
	global $wp_query;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   531
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   532
	if ( ! isset( $wp_query ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   533
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   534
		return false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   535
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   536
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   537
	return $wp_query->is_privacy_policy();
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   538
}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   539
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   540
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   541
 * Determines whether the query is for an existing month archive.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   542
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   543
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   544
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   545
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   546
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   547
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   548
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   549
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   550
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   551
 * @return bool Whether the query is for an existing month archive.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   552
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
function is_month() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   556
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   557
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   558
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   559
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   560
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   561
	return $wp_query->is_month();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   562
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   563
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   564
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   565
 * Determines whether the query is for an existing single page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   566
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   567
 * If the $page parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   568
 * check if the query is for one of the pages specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   569
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   570
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   571
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   572
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   573
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   574
 * @since 1.5.0
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   575
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   576
 * @see is_single()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   577
 * @see is_singular()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   578
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   579
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   580
 * @param int|string|int[]|string[] $page Optional. Page ID, title, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   581
 *                                        to check against. Default empty.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   582
 * @return bool Whether the query is for an existing single page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   583
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   584
function is_page( $page = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   585
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   586
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   587
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   588
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   589
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   590
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   591
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   592
	return $wp_query->is_page( $page );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   593
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   594
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   595
/**
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   596
 * Determines whether the query is for a paged result and not for the first page.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   597
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   598
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   599
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   600
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   601
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   602
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   603
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   604
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   605
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   606
 * @return bool Whether the query is for a paged result.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   607
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   608
function is_paged() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   612
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   613
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
	return $wp_query->is_paged();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   620
 * Determines whether the query is for a post or page preview.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   621
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   622
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   623
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   624
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   625
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   626
 * @since 2.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   627
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   628
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   629
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   630
 * @return bool Whether the query is for a post or page preview.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   631
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   632
function is_preview() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   633
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   634
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   635
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   636
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   637
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   638
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   639
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   640
	return $wp_query->is_preview();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   641
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   642
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   643
/**
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   644
 * Is the query for the robots.txt file?
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   645
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   646
 * @since 2.1.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   647
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   648
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   649
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   650
 * @return bool Whether the query is for the robots.txt file.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   651
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   652
function is_robots() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   653
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   654
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   655
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   656
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   657
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   658
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   659
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   660
	return $wp_query->is_robots();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   661
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   662
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   663
/**
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   664
 * Is the query for the favicon.ico file?
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   665
 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   666
 * @since 5.4.0
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   667
 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   668
 * @global WP_Query $wp_query WordPress Query object.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   669
 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   670
 * @return bool Whether the query is for the favicon.ico file.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   671
 */
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   672
function is_favicon() {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   673
	global $wp_query;
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   674
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   675
	if ( ! isset( $wp_query ) ) {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   676
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   677
		return false;
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   678
	}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   679
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   680
	return $wp_query->is_favicon();
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   681
}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   682
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   683
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   684
 * Determines whether the query is for a search.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   685
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   686
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   687
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   688
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   689
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   690
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   691
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   692
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   694
 * @return bool Whether the query is for a search.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   695
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   696
function is_search() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   697
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   700
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   704
	return $wp_query->is_search();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   706
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   707
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   708
 * Determines whether the query is for an existing single post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   709
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   710
 * Works for any post type, except attachments and pages
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   711
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   712
 * If the $post parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   713
 * check if the query is for one of the Posts specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   714
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   715
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   716
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   717
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   718
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   719
 * @since 1.5.0
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   720
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   721
 * @see is_page()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   722
 * @see is_singular()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   723
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   724
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   725
 * @param int|string|int[]|string[] $post Optional. Post ID, title, slug, or array of such
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   726
 *                                        to check against. Default empty.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   727
 * @return bool Whether the query is for an existing single post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   728
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   729
function is_single( $post = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   730
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   731
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   732
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   733
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   734
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   735
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   736
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   737
	return $wp_query->is_single( $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   738
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   739
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   740
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   741
 * Determines whether the query is for an existing single post of any post type
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   742
 * (post, attachment, page, custom post types).
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   743
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   744
 * If the $post_types parameter is specified, this function will additionally
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   745
 * check if the query is for one of the Posts Types specified.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   746
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   747
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   748
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   749
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   750
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   751
 * @since 1.5.0
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   752
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   753
 * @see is_page()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   754
 * @see is_single()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   755
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   756
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   757
 * @param string|string[] $post_types Optional. Post type or array of post types
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   758
 *                                    to check against. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   759
 * @return bool Whether the query is for an existing single post
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   760
 *              or any of the given post types.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   761
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   762
function is_singular( $post_types = '' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   763
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   764
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   765
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   766
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   767
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   768
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   769
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   770
	return $wp_query->is_singular( $post_types );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   771
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   772
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   773
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   774
 * Determines whether the query is for a specific time.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   775
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   776
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   777
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   778
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   779
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   780
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   781
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   782
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   783
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   784
 * @return bool Whether the query is for a specific time.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   785
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   786
function is_time() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   787
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   788
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   789
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   790
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   791
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   792
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   793
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   794
	return $wp_query->is_time();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   795
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   796
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   797
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   798
 * Determines whether the query is for a trackback endpoint call.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   799
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   800
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   801
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   802
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   803
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   804
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   805
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   806
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   807
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   808
 * @return bool Whether the query is for a trackback endpoint call.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   809
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   810
function is_trackback() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   811
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   812
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   813
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   814
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   815
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   816
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   817
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   818
	return $wp_query->is_trackback();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   819
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   820
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   821
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   822
 * Determines whether the query is for an existing year archive.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   823
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   824
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   825
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   826
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   827
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   828
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   829
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   830
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   831
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   832
 * @return bool Whether the query is for an existing year archive.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   833
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   834
function is_year() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   835
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   836
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   837
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   838
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   839
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   840
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   841
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   842
	return $wp_query->is_year();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   843
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   844
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   845
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   846
 * Determines whether the query has resulted in a 404 (returns no results).
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   847
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   848
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   849
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   850
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   851
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   852
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   853
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   854
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   855
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   856
 * @return bool Whether the query is a 404 error.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   857
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   858
function is_404() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   859
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   860
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   861
	if ( ! isset( $wp_query ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   862
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   863
		return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   864
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   865
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   866
	return $wp_query->is_404();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   867
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   868
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   869
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   870
 * Is the query for an embedded post?
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   871
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   872
 * @since 4.4.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   873
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   874
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   875
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   876
 * @return bool Whether the query is for an embedded post.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   877
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   878
function is_embed() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   879
	global $wp_query;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   880
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   881
	if ( ! isset( $wp_query ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   882
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   883
		return false;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   884
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   885
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   886
	return $wp_query->is_embed();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   887
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   888
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   889
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   890
 * Determines whether the query is the main query.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   891
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   892
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   893
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   894
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   895
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   896
 * @since 3.3.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   897
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   898
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   899
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   900
 * @return bool Whether the query is the main query.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   901
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   902
function is_main_query() {
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   903
	global $wp_query;
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   904
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   905
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   906
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '6.1.0' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   907
		return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   908
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   909
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   910
	if ( 'pre_get_posts' === current_filter() ) {
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   911
		_doing_it_wrong(
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   912
			__FUNCTION__,
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   913
			sprintf(
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   914
				/* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   915
				__( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   916
				'<code>pre_get_posts</code>',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   917
				'<code>WP_Query->is_main_query()</code>',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   918
				'<code>is_main_query()</code>',
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   919
				__( 'https://developer.wordpress.org/reference/functions/is_main_query/' )
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   920
			),
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   921
			'3.7.0'
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   922
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   923
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   924
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   925
	return $wp_query->is_main_query();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   926
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   927
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   928
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   929
 * The Loop. Post loop control.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   930
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   931
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   932
/**
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   933
 * Determines whether current WordPress query has posts to loop over.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   934
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   935
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   936
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   937
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   938
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   939
 * @return bool True if posts are available, false if end of the loop.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   940
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   941
function have_posts() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   942
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   943
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   944
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   945
		return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   946
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   947
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   948
	return $wp_query->have_posts();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   949
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   950
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   951
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   952
 * Determines whether the caller is in the Loop.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   953
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   954
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   955
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   956
 * Conditional Tags} article in the Theme Developer Handbook.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   957
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   958
 * @since 2.0.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   959
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   960
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   961
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   962
 * @return bool True if caller is within loop, false if loop hasn't started or ended.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   963
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   964
function in_the_loop() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   965
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   966
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   967
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   968
		return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   969
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   970
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   971
	return $wp_query->in_the_loop;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   972
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   973
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   974
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   975
 * Rewind the loop posts.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   976
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   977
 * @since 1.5.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   978
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   979
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   980
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   981
function rewind_posts() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   982
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   983
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   984
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   985
		return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   986
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   987
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   988
	$wp_query->rewind_posts();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   989
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   990
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   991
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   992
 * Iterate the post index in the loop.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   993
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   994
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   995
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   996
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   997
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   998
function the_post() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   999
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1000
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1001
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1002
		return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1003
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1004
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1005
	$wp_query->the_post();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1006
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1007
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1008
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1009
 * Comments loop.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1010
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1011
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1012
/**
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1013
 * Determines whether current WordPress query has comments to loop over.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1014
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1015
 * @since 2.2.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1016
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1017
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1018
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1019
 * @return bool True if comments are available, false if no more comments.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1020
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1021
function have_comments() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1022
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1023
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1024
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1025
		return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1026
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1027
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1028
	return $wp_query->have_comments();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1029
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1030
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1031
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1032
 * Iterate comment index in the comment loop.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1033
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1034
 * @since 2.2.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1035
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1036
 * @global WP_Query $wp_query WordPress Query object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1037
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1038
function the_comment() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1039
	global $wp_query;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1040
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1041
	if ( ! isset( $wp_query ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1042
		return;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1043
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1044
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1045
	$wp_query->the_comment();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1046
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1047
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1048
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1049
 * Redirect old slugs to the correct permalink.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1050
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1051
 * Attempts to find the current slug from the past slugs.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1052
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1053
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1054
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1055
function wp_old_slug_redirect() {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1056
	if ( is_404() && '' !== get_query_var( 'name' ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1057
		// Guess the current post type based on the query vars.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1058
		if ( get_query_var( 'post_type' ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1059
			$post_type = get_query_var( 'post_type' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1060
		} elseif ( get_query_var( 'attachment' ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1061
			$post_type = 'attachment';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1062
		} elseif ( get_query_var( 'pagename' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1063
			$post_type = 'page';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1064
		} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1065
			$post_type = 'post';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1066
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1067
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1068
		if ( is_array( $post_type ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1069
			if ( count( $post_type ) > 1 ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1070
				return;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1071
			}
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1072
			$post_type = reset( $post_type );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1073
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1074
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1075
		// Do not attempt redirect for hierarchical post types.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1076
		if ( is_post_type_hierarchical( $post_type ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1077
			return;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1078
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1079
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1080
		$id = _find_post_by_old_slug( $post_type );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1081
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1082
		if ( ! $id ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1083
			$id = _find_post_by_old_date( $post_type );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1084
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1085
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1086
		/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1087
		 * Filters the old slug redirect post ID.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1088
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1089
		 * @since 4.9.3
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1090
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1091
		 * @param int $id The redirect post ID.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1092
		 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1093
		$id = apply_filters( 'old_slug_redirect_post_id', $id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1094
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1095
		if ( ! $id ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1096
			return;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1097
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1098
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1099
		$link = get_permalink( $id );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1100
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1101
		if ( get_query_var( 'paged' ) > 1 ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1102
			$link = user_trailingslashit( trailingslashit( $link ) . 'page/' . get_query_var( 'paged' ) );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1103
		} elseif ( is_embed() ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1104
			$link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1105
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1106
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1107
		/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1108
		 * Filters the old slug redirect URL.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1109
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1110
		 * @since 4.4.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1111
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1112
		 * @param string $link The redirect URL.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1113
		 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1114
		$link = apply_filters( 'old_slug_redirect_url', $link );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1115
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1116
		if ( ! $link ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1117
			return;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1118
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1119
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1120
		wp_redirect( $link, 301 ); // Permanent redirect.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1121
		exit;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1122
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1123
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1124
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1125
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1126
 * Find the post ID for redirecting an old slug.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1127
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1128
 * @since 4.9.3
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1129
 * @access private
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1130
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
  1131
 * @see wp_old_slug_redirect()
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1132
 * @global wpdb $wpdb WordPress database abstraction object.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1133
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1134
 * @param string $post_type The current post type based on the query vars.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1135
 * @return int The Post ID.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1136
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1137
function _find_post_by_old_slug( $post_type ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1138
	global $wpdb;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1139
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1140
	$query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, get_query_var( 'name' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1141
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1142
	/*
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1143
	 * If year, monthnum, or day have been specified, make our query more precise
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1144
	 * just in case there are multiple identical _wp_old_slug values.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1145
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1146
	if ( get_query_var( 'year' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1147
		$query .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1148
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1149
	if ( get_query_var( 'monthnum' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1150
		$query .= $wpdb->prepare( ' AND MONTH(post_date) = %d', get_query_var( 'monthnum' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1151
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1152
	if ( get_query_var( 'day' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1153
		$query .= $wpdb->prepare( ' AND DAYOFMONTH(post_date) = %d', get_query_var( 'day' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1154
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1155
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1156
	$key          = md5( $query );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1157
	$last_changed = wp_cache_get_last_changed( 'posts' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1158
	$cache_key    = "find_post_by_old_slug:$key:$last_changed";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1159
	$cache        = wp_cache_get( $cache_key, 'post-queries' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1160
	if ( false !== $cache ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1161
		$id = $cache;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1162
	} else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1163
		$id = (int) $wpdb->get_var( $query );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1164
		wp_cache_set( $cache_key, $id, 'post-queries' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1165
	}
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1166
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1167
	return $id;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1168
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1169
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1170
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1171
 * Find the post ID for redirecting an old date.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1172
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1173
 * @since 4.9.3
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1174
 * @access private
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1175
 *
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
  1176
 * @see wp_old_slug_redirect()
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1177
 * @global wpdb $wpdb WordPress database abstraction object.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1178
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1179
 * @param string $post_type The current post type based on the query vars.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1180
 * @return int The Post ID.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1181
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1182
function _find_post_by_old_date( $post_type ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1183
	global $wpdb;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1184
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1185
	$date_query = '';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1186
	if ( get_query_var( 'year' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1187
		$date_query .= $wpdb->prepare( ' AND YEAR(pm_date.meta_value) = %d', get_query_var( 'year' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1188
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1189
	if ( get_query_var( 'monthnum' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1190
		$date_query .= $wpdb->prepare( ' AND MONTH(pm_date.meta_value) = %d', get_query_var( 'monthnum' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1191
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1192
	if ( get_query_var( 'day' ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1193
		$date_query .= $wpdb->prepare( ' AND DAYOFMONTH(pm_date.meta_value) = %d', get_query_var( 'day' ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1194
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1195
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1196
	$id = 0;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1197
	if ( $date_query ) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1198
		$query        = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta AS pm_date, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_date' AND post_name = %s" . $date_query, $post_type, get_query_var( 'name' ) );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1199
		$key          = md5( $query );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1200
		$last_changed = wp_cache_get_last_changed( 'posts' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1201
		$cache_key    = "find_post_by_old_date:$key:$last_changed";
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1202
		$cache        = wp_cache_get( $cache_key, 'post-queries' );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1203
		if ( false !== $cache ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1204
			$id = $cache;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1205
		} else {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1206
			$id = (int) $wpdb->get_var( $query );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1207
			if ( ! $id ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1208
				// Check to see if an old slug matches the old date.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1209
				$id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts, $wpdb->postmeta AS pm_slug, $wpdb->postmeta AS pm_date WHERE ID = pm_slug.post_id AND ID = pm_date.post_id AND post_type = %s AND pm_slug.meta_key = '_wp_old_slug' AND pm_slug.meta_value = %s AND pm_date.meta_key = '_wp_old_date'" . $date_query, $post_type, get_query_var( 'name' ) ) );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1210
			}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
  1211
			wp_cache_set( $cache_key, $id, 'post-queries' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1212
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1213
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1214
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1215
	return $id;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1216
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1217
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1218
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1219
 * Set up global post data.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1220
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1221
 * @since 1.5.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1222
 * @since 4.4.0 Added the ability to pass a post ID to `$post`.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1223
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1224
 * @global WP_Query $wp_query WordPress Query object.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1225
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
  1226
 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1227
 * @return bool True when finished.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1228
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1229
function setup_postdata( $post ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1230
	global $wp_query;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1231
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1232
	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1233
		return $wp_query->setup_postdata( $post );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1234
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1235
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1236
	return false;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1237
}
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1238
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1239
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1240
 * Generates post data.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1241
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1242
 * @since 5.2.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1243
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
  1244
 * @global WP_Query $wp_query WordPress Query object.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1245
 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1246
 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
  1247
 * @return array|false Elements of post, or false on failure.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1248
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1249
function generate_postdata( $post ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1250
	global $wp_query;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1251
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1252
	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1253
		return $wp_query->generate_postdata( $post );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1254
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1255
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1256
	return false;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
  1257
}