[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

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

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

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

Defines 1 class

WP_Query:: (23 methods):
  init_query_flags()
  init()
  parse_query_vars()
  fill_query_vars()
  parse_query()
  set_404()
  get()
  set()
  get_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()
  WP_Query()
  wp_old_slug_redirect()
  setup_postdata()

Defines 23 functions

  get_query_var()
  set_query_var()
  query_posts()
  wp_reset_query()
  is_archive()
  is_attachment()
  is_author()
  is_category()
  is_tag()
  is_tax()
  is_comments_popup()
  is_date()
  is_day()
  is_feed()
  is_front_page()
  is_home()
  is_month()
  is_page()
  is_paged()
  is_plugin_page()
  is_preview()
  is_robots()
  is_search()
  is_single()
  is_singular()
  is_time()
  is_trackback()
  is_year()
  is_404()
  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

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.

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

return: object 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

WP_Query($query = '')   X-Ref
PHP4 type constructor.

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

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

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
Setup 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

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
Setup 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 setup 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 setup.


is_archive()   X-Ref
Is query requesting an archive page.

return: bool True if page is archive.

is_attachment()   X-Ref
Is query requesting an attachment page.

return: bool True if page is attachment.

is_author($author = '')   X-Ref
Is query requesting an author page.

If the $author parameter is specified then the check will be expanded to
include whether the queried author matches the one given in the parameter.
You can match against integers and against strings.

If matching against an integer, the ID should be used of the author for the
test. If the $author is an ID and matches the author page user ID, then
'true' will be returned.

If matching against strings, then the test will be matched against both the
nickname and user nicename and will return true on success.

param: string|int $author Optional. Is current page this author.
return: bool True if page is author or $author (if set).

is_category($category = '')   X-Ref
Whether current page query contains a category name or given category name.

The category list can contain category IDs, names, or category slugs. If any
of them are part of the query, then it will return true.

param: string|array $category Optional.
return: bool

is_tag( $slug = '' )   X-Ref
Whether the current page query has the given tag slug or contains tag.

param: string|array $slug Optional. Single tag or list of tags to check for.
return: bool

is_tax( $slug = '' )   X-Ref
Whether the current page query has the given taxonomy slug or contains taxonomy.

param: string|array $slug Optional. Slug or slugs to check in current query.
return: bool

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

return: bool

is_date()   X-Ref
Whether current URL is based on a date.

return: bool

is_day()   X-Ref
Whether current blog URL contains a day.

return: bool

is_feed()   X-Ref
Whether current page query is feed URL.

return: bool

is_front_page()   X-Ref
Whether current page query is the front of the site.

return: bool True, if front of site.

is_home()   X-Ref
Whether current page view is the blog homepage.

return: bool True if blog view homepage.

is_month()   X-Ref
Whether current page query contains a month.

return: bool

is_page($page = '')   X-Ref
Whether query is page or contains given page(s).

Calls the function without any parameters will only test whether the current
query is of the page type. Either a list or a single item can be tested
against for whether the query is a page and also is the value or one of the
values in the page parameter.

The parameter can contain the page ID, page title, or page name. The
parameter can also be an array of those three values.

param: mixed $page Either page or list of pages to test against.
return: bool

is_paged()   X-Ref
Whether query contains multiple pages for the results.

return: bool

is_plugin_page()   X-Ref
Whether the current page was created by a plugin.

The plugin can set this by using the global $plugin_page and setting it to
true.

return: bool

is_preview()   X-Ref
Whether the current query is preview of post or page.

return: bool

is_robots()   X-Ref
Whether the current query post is robots.

return: bool

is_search()   X-Ref
Whether current query is the result of a user search.

return: bool

is_single($post = '')   X-Ref
Whether the current page query is single page.

The parameter can contain the post ID, post title, or post name. The
parameter can also be an array of those three values.

This applies to other post types, attachments, pages, posts. Just means that
the current query has only a single object.

param: mixed $post Either post or list of posts to test against.
return: bool

is_singular()   X-Ref
Whether is single post, is a page, or is an attachment.

return: bool

is_time()   X-Ref
Whether the query contains a time.

return: bool

is_trackback()   X-Ref
Whether the query is a trackback.

return: bool

is_year()   X-Ref
Whether the query contains a year.

return: bool

is_404()   X-Ref
Whether current page query is a 404 and no results for WordPress query.

return: bool True, if nothing is found matching WordPress Query.

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: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7