[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/ -> query.php (summary)

WordPress Query API The query API attempts to get which part of WordPress the user is on. It also provides functionality for getting URL query information.

File Size: 3973 lines (105 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Query:: (57 methods):
  init_query_flags()
  init()
  parse_query_vars()
  fill_query_vars()
  parse_query()
  parse_tax_query()
  parse_search()
  parse_search_terms()
  get_search_stopwords()
  parse_search_order()
  set_404()
  get()
  set()
  get_posts()
  set_found_posts()
  next_post()
  the_post()
  have_posts()
  rewind_posts()
  next_comment()
  the_comment()
  have_comments()
  rewind_comments()
  query()
  get_queried_object()
  get_queried_object_id()
  __construct()
  is_archive()
  is_post_type_archive()
  is_attachment()
  is_author()
  is_category()
  is_tag()
  is_tax()
  is_comments_popup()
  is_date()
  is_day()
  is_feed()
  is_comment_feed()
  is_front_page()
  is_home()
  is_month()
  is_page()
  is_paged()
  is_preview()
  is_robots()
  is_search()
  is_single()
  is_singular()
  is_time()
  is_trackback()
  is_year()
  is_404()
  is_main_query()
  reset_postdata()
  wp_old_slug_redirect()
  setup_postdata()

Defines 57 functions

  get_query_var()
  get_queried_object()
  get_queried_object_id()
  set_query_var()
  query_posts()
  wp_reset_query()
  wp_reset_postdata()
  is_archive()
  is_post_type_archive()
  is_attachment()
  is_author()
  is_category()
  is_tag()
  is_tax()
  is_comments_popup()
  is_date()
  is_day()
  is_feed()
  is_comment_feed()
  is_front_page()
  is_home()
  is_month()
  is_page()
  is_paged()
  is_preview()
  is_robots()
  is_search()
  is_single()
  is_singular()
  is_time()
  is_trackback()
  is_year()
  is_404()
  is_main_query()
  have_posts()
  in_the_loop()
  rewind_posts()
  the_post()
  have_comments()
  the_comment()

Class: WP_Query  - X-Ref

The WordPress Query class.

init_query_flags()   X-Ref
Resets query flags to false.

The query flags are what page info WordPress was able to figure out.


init()   X-Ref
Initiates object properties and sets default values.


parse_query_vars()   X-Ref
Reparse the query vars.


fill_query_vars($array)   X-Ref
Fills in the query variables, which do not exist within the parameter.

param: array $array Defined query variables.
return: array Complete query variables with undefined ones filled in empty.

parse_query( $query = '' )   X-Ref
Parse a query string and set query type booleans.

param: string|array $query Optional query.

parse_tax_query( &$q )   X-Ref
Parses various taxonomy related query vars.

param: array &$q The query variables

parse_search( &$q )   X-Ref
Generate SQL for the WHERE clause based on passed search terms.

param: array $q Query variables.
return: string WHERE clause.

parse_search_terms( $terms )   X-Ref
Check if the terms are suitable for searching.

Uses an array of stopwords (terms) that are excluded from the separate
term matching when searching for posts. The list of English stopwords is
the approximate search engines list, and is translatable.

param: array Terms to check.
return: array Terms that are not stopwords.

get_search_stopwords()   X-Ref
Retrieve stopwords used when parsing search terms.

return: array Stopwords.

parse_search_order( &$q )   X-Ref
Generate SQL for the ORDER BY condition based on passed search terms.

param: array $q Query variables.
return: string ORDER BY clause.

set_404()   X-Ref
Sets the 404 property and saves whether query is feed.


get($query_var)   X-Ref
Retrieve query variable.

param: string $query_var Query variable key.
return: mixed

set($query_var, $value)   X-Ref
Set query variable.

param: string $query_var Query variable key.
param: mixed $value Query variable value.

get_posts()   X-Ref
Retrieve the posts based on query variables.

There are a few filters and actions that can be used to modify the post
database query.

return: array List of posts.

set_found_posts( $q, $limits )   X-Ref
Set up the amount of found posts and the number of pages (if limit clause was used)
for the current query.


next_post()   X-Ref
Set up the next post and iterate current post index.

return: WP_Post Next post.

the_post()   X-Ref
Sets up the current post.

Retrieves the next post, sets up the post, sets the 'in the loop'
property to true.


have_posts()   X-Ref
Whether there are more posts available in the loop.

Calls action 'loop_end', when the loop is complete.

return: bool True if posts are available, false if end of loop.

rewind_posts()   X-Ref
Rewind the posts and reset post index.


next_comment()   X-Ref
Iterate current comment index and return comment object.

return: object Comment object.

the_comment()   X-Ref
Sets up the current comment.


have_comments()   X-Ref
Whether there are more comments available.

Automatically rewinds comments when finished.

return: bool True, if more comments. False, if no more posts.

rewind_comments()   X-Ref
Rewind the comments, resets the comment index and comment to first.


query( $query )   X-Ref
Sets up the WordPress query by parsing query string.

param: string $query URL query string.
return: array List of posts.

get_queried_object()   X-Ref
Retrieve queried object.

If queried object is not set, then the queried object will be set from
the category, tag, taxonomy, posts page, single post, page, or author
query variable. After it is set up, it will be returned.

return: object

get_queried_object_id()   X-Ref
Retrieve ID of the current queried object.

return: int

__construct($query = '')   X-Ref
Constructor.

Sets up the WordPress query, if parameter is not empty.

param: string $query URL query string.
return: WP_Query

is_archive()   X-Ref
Is the query for an existing archive page?

Month, Year, Category, Author, Post Type archive...

return: bool

is_post_type_archive( $post_types = '' )   X-Ref
Is the query for an existing post type archive page?

param: mixed $post_types Optional. Post type or array of posts types to check against.
return: bool

is_attachment()   X-Ref
Is the query for an existing attachment page?

return: bool

is_author( $author = '' )   X-Ref
Is the query for an existing author archive page?

If the $author parameter is specified, this function will additionally
check if the query is for one of the authors specified.

param: mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
return: bool

is_category( $category = '' )   X-Ref
Is the query for an existing category archive page?

If the $category parameter is specified, this function will additionally
check if the query is for one of the categories specified.

param: mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
return: bool

is_tag( $tag = '' )   X-Ref
Is the query for an existing tag archive page?

If the $tag parameter is specified, this function will additionally
check if the query is for one of the tags specified.

param: mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
return: bool

is_tax( $taxonomy = '', $term = '' )   X-Ref
Is the query for an existing taxonomy archive page?

If the $taxonomy parameter is specified, this function will additionally
check if the query is for that specific $taxonomy.

If the $term parameter is specified in addition to the $taxonomy parameter,
this function will additionally check if the query is for one of the terms
specified.

param: mixed $taxonomy Optional. Taxonomy slug or slugs.
param: mixed $term. Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
return: bool

is_comments_popup()   X-Ref
Whether the current URL is within the comments popup window.

return: bool

is_date()   X-Ref
Is the query for an existing date archive?

return: bool

is_day()   X-Ref
Is the query for an existing day archive?

return: bool

is_feed( $feeds = '' )   X-Ref
Is the query for a feed?

param: string|array $feeds Optional feed types to check.
return: bool

is_comment_feed()   X-Ref
Is the query for a comments feed?

return: bool

is_front_page()   X-Ref
Is the query for the front page of the site?

This is for what is displayed at your site's main URL.

Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'.

If you set a static page for the front page of your site, this function will return
true when viewing that page.

Otherwise the same as @see WP_Query::is_home()

return: bool True, if front of site.

is_home()   X-Ref
Is the query for the blog homepage?

This is the page which shows the time based blog content of your site.

Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'.

If you set a static page for the front page of your site, this function will return
true only on the page you set as the "Posts page".

return: bool True if blog view homepage.

is_month()   X-Ref
Is the query for an existing month archive?

return: bool

is_page( $page = '' )   X-Ref
Is the query for an existing single page?

If the $page parameter is specified, this function will additionally
check if the query is for one of the pages specified.

param: mixed $page Page ID, title, slug, or array of such.
return: bool

is_paged()   X-Ref
Is the query for paged result and not for the first page?

return: bool

is_preview()   X-Ref
Is the query for a post or page preview?

return: bool

is_robots()   X-Ref
Is the query for the robots file?

return: bool

is_search()   X-Ref
Is the query for a search?

return: bool

is_single( $post = '' )   X-Ref
Is the query for an existing single post?

Works for any post type, except attachments and pages

If the $post parameter is specified, this function will additionally
check if the query is for one of the Posts specified.

param: mixed $post Post ID, title, slug, or array of such.
return: bool

is_singular( $post_types = '' )   X-Ref
Is the query for an existing single post of any post type (post, attachment, page, ... )?

If the $post_types parameter is specified, this function will additionally
check if the query is for one of the Posts Types specified.

param: mixed $post_types Optional. Post Type or array of Post Types
return: bool

is_time()   X-Ref
Is the query for a specific time?

return: bool

is_trackback()   X-Ref
Is the query for a trackback endpoint call?

return: bool

is_year()   X-Ref
Is the query for an existing year archive?

return: bool

is_404()   X-Ref
Is the query a 404 (returns no results)?

return: bool

is_main_query()   X-Ref
Is the query the main query?

return: bool

reset_postdata()   X-Ref
After looping through a nested query, this function
restores the $post global to the current post in this query.

return: bool

wp_old_slug_redirect()   X-Ref
Redirect old slugs to the correct permalink.

Attempts to find the current slug from the past slugs.

return: null If no link is found, null is returned.

setup_postdata( $post )   X-Ref
Set up global post data.

param: object $post Post data.
return: bool True when finished.

Functions
Functions that are not part of a class:

get_query_var($var)   X-Ref
Retrieve variable in the WP_Query class.

param: string $var The variable key to retrieve.
return: mixed

get_queried_object()   X-Ref
Retrieve the currently-queried object. Wrapper for $wp_query->get_queried_object()

return: object

get_queried_object_id()   X-Ref
Retrieve ID of the current queried object. Wrapper for $wp_query->get_queried_object_id()

return: int

set_query_var($var, $value)   X-Ref
Set query variable.

param: string $var Query variable key.
param: mixed $value
return: null

query_posts($query)   X-Ref
Set up The Loop with query parameters.

This will override the current WordPress Loop and shouldn't be used more than
once. This must not be used within the WordPress Loop.

param: string $query
return: array List of posts

wp_reset_query()   X-Ref
Destroy the previous query and set up a new query.

This should be used after {@link query_posts()} and before another {@link
query_posts()}. This will remove obscure bugs that occur when the previous
wp_query object is not destroyed properly before another is set up.


wp_reset_postdata()   X-Ref
After looping through a separate query, this function restores
the $post global to the current post in the main query.


is_archive()   X-Ref
Is the query for an existing archive page?

Month, Year, Category, Author, Post Type archive...

return: bool

is_post_type_archive( $post_types = '' )   X-Ref
Is the query for an existing post type archive page?

param: mixed $post_types Optional. Post type or array of posts types to check against.
return: bool

is_attachment()   X-Ref
Is the query for an existing attachment page?

return: bool

is_author( $author = '' )   X-Ref
Is the query for an existing author archive page?

If the $author parameter is specified, this function will additionally
check if the query is for one of the authors specified.

param: mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
return: bool

is_category( $category = '' )   X-Ref
Is the query for an existing category archive page?

If the $category parameter is specified, this function will additionally
check if the query is for one of the categories specified.

param: mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
return: bool

is_tag( $tag = '' )   X-Ref
Is the query for an existing tag archive page?

If the $tag parameter is specified, this function will additionally
check if the query is for one of the tags specified.

param: mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
return: bool

is_tax( $taxonomy = '', $term = '' )   X-Ref
Is the query for an existing taxonomy archive page?

If the $taxonomy parameter is specified, this function will additionally
check if the query is for that specific $taxonomy.

If the $term parameter is specified in addition to the $taxonomy parameter,
this function will additionally check if the query is for one of the terms
specified.

param: mixed $taxonomy Optional. Taxonomy slug or slugs.
param: mixed $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
return: bool

is_comments_popup()   X-Ref
Whether the current URL is within the comments popup window.

return: bool

is_date()   X-Ref
Is the query for an existing date archive?

return: bool

is_day()   X-Ref
Is the query for an existing day archive?

return: bool

is_feed( $feeds = '' )   X-Ref
Is the query for a feed?

param: string|array $feeds Optional feed types to check.
return: bool

is_comment_feed()   X-Ref
Is the query for a comments feed?

return: bool

is_front_page()   X-Ref
Is the query for the front page of the site?

This is for what is displayed at your site's main URL.

Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'.

If you set a static page for the front page of your site, this function will return
true when viewing that page.

Otherwise the same as @see is_home()

return: bool True, if front of site.

is_home()   X-Ref
Is the query for the blog homepage?

This is the page which shows the time based blog content of your site.

Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'.

If you set a static page for the front page of your site, this function will return
true only on the page you set as the "Posts page".

return: bool True if blog view homepage.

is_month()   X-Ref
Is the query for an existing month archive?

return: bool

is_page( $page = '' )   X-Ref
Is the query for an existing single page?

If the $page parameter is specified, this function will additionally
check if the query is for one of the pages specified.

param: mixed $page Page ID, title, slug, or array of such.
return: bool

is_paged()   X-Ref
Is the query for paged result and not for the first page?

return: bool

is_preview()   X-Ref
Is the query for a post or page preview?

return: bool

is_robots()   X-Ref
Is the query for the robots file?

return: bool

is_search()   X-Ref
Is the query for a search?

return: bool

is_single( $post = '' )   X-Ref
Is the query for an existing single post?

Works for any post type, except attachments and pages

If the $post parameter is specified, this function will additionally
check if the query is for one of the Posts specified.

param: mixed $post Post ID, title, slug, or array of such.
return: bool

is_singular( $post_types = '' )   X-Ref
Is the query for an existing single post of any post type (post, attachment, page, ... )?

If the $post_types parameter is specified, this function will additionally
check if the query is for one of the Posts Types specified.

param: mixed $post_types Optional. Post Type or array of Post Types
return: bool

is_time()   X-Ref
Is the query for a specific time?

return: bool

is_trackback()   X-Ref
Is the query for a trackback endpoint call?

return: bool

is_year()   X-Ref
Is the query for an existing year archive?

return: bool

is_404()   X-Ref
Is the query a 404 (returns no results)?

return: bool

is_main_query()   X-Ref
Is the query the main query?

return: bool

have_posts()   X-Ref
Whether current WordPress query has results to loop over.

return: bool

in_the_loop()   X-Ref
Whether the caller is in the Loop.

return: bool True if caller is within loop, false if loop hasn't started or ended.

rewind_posts()   X-Ref
Rewind the loop posts.

return: null

the_post()   X-Ref
Iterate the post index in the loop.


have_comments()   X-Ref
Whether there are comments to loop over.

return: bool

the_comment()   X-Ref
Iterate comment index in the comment loop.

return: object



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu