[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

/wp-includes/ -> category-template.php (summary)

Category Template Tags and API.

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

Defines 28 functions

  get_category_link()
  get_category_parents()
  get_the_category()
  _usort_terms_by_name()
  _usort_terms_by_ID()
  get_the_category_by_ID()
  get_the_category_list()
  in_category()
  the_category()
  category_description()
  wp_dropdown_categories()
  wp_list_categories()
  wp_tag_cloud()
  default_topic_count_text()
  default_topic_count_scale()
  wp_generate_tag_cloud()
  walk_category_tree()
  walk_category_dropdown_tree()
  get_tag_link()
  get_the_tags()
  get_the_tag_list()
  the_tags()
  tag_description()
  term_description()
  get_the_terms()
  get_the_term_list()
  the_terms()
  has_tag()

Functions
Functions that are not part of a class:

get_category_link( $category_id )   X-Ref
Retrieve category link URL.

param: int $category_id Category ID.
return: string

get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array()   X-Ref
Retrieve category parents with separator.

param: int $id Category ID.
param: bool $link Optional, default is false. Whether to format with link.
param: string $separator Optional, default is '/'. How to separate categories.
param: bool $nicename Optional, default is false. Whether to use nice name for display.
param: array $visited Optional. Already linked to categories to prevent duplicates.
return: string

get_the_category( $id = false )   X-Ref
Retrieve post categories.

param: int $id Optional, default to current post ID. The post ID.
return: array

_usort_terms_by_name( $a, $b )   X-Ref
Sort categories by name.

Used by usort() as a callback, should not be used directly. Can actually be
used to sort any term object.

param: object $a
param: object $b
return: int

_usort_terms_by_ID( $a, $b )   X-Ref
Sort categories by ID.

Used by usort() as a callback, should not be used directly. Can actually be
used to sort any term object.

param: object $a
param: object $b
return: int

get_the_category_by_ID( $cat_ID )   X-Ref
Retrieve category name based on category ID.

param: int $cat_ID Category ID.
return: string Category name.

get_the_category_list( $separator = '', $parents='', $post_id = false )   X-Ref
Retrieve category list in either HTML list or custom format.

param: string $separator Optional, default is empty string. Separator for between the categories.
param: string $parents Optional. How to display the parents.
param: int $post_id Optional. Post ID to retrieve categories.
return: string

in_category( $category, $_post = null )   X-Ref
Check if the current post in within any of the given categories.

The given categories are checked against the post's categories' term_ids, names and slugs.
Categories given as integers will only be checked against the post's categories' term_ids.

Prior to v2.5 of WordPress, category names were not supported.
Prior to v2.7, category slugs were not supported.
Prior to v2.7, only one category could be compared: in_category( $single_category ).
Prior to v2.7, this function could only be used in the WordPress Loop.
As of 2.7, the function can be used anywhere if it is provided a post ID or post object.

param: int|string|array $category. Category ID, name or slug, or array of said.
param: int|post object Optional.  Post to check instead of the current post. @since 2.7.0
return: bool True if the current post is in any of the given categories.

the_category( $separator = '', $parents='', $post_id = false )   X-Ref
Display the category list for the post.

param: string $separator Optional, default is empty string. Separator for between the categories.
param: string $parents Optional. How to display the parents.
param: int $post_id Optional. Post ID to retrieve categories.

category_description( $category = 0 )   X-Ref
Retrieve category description.

param: int $category Optional. Category ID. Will use global category ID by default.
return: string Category description, available.

wp_dropdown_categories( $args = '' )   X-Ref
Display or retrieve the HTML dropdown list of categories.

The list of arguments is below:
'show_option_all' (string) - Text to display for showing all categories.
'show_option_none' (string) - Text to display for showing no categories.
'orderby' (string) default is 'ID' - What column to use for ordering the
categories.
'order' (string) default is 'ASC' - What direction to order categories.
'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
'show_count' (bool|int) default is 0 - Whether to show how many posts are
in the category.
'hide_empty' (bool|int) default is 1 - Whether to hide categories that
don't have any posts attached to them.
'child_of' (int) default is 0 - See {@link get_categories()}.
'exclude' (string) - See {@link get_categories()}.
'echo' (bool|int) default is 1 - Whether to display or retrieve content.
'depth' (int) - The max depth.
'tab_index' (int) - Tab index for select element.
'name' (string) - The name attribute value for selected element.
'class' (string) - The class attribute value for selected element.
'selected' (int) - Which category ID is selected.

The 'hierarchical' argument, which is disabled by default, will override the
depth argument, unless it is true. When the argument is false, it will
display all of the categories. When it is enabled it will use the value in
the 'depth' argument.

param: string|array $args Optional. Override default arguments.
return: string HTML content only if 'echo' argument is 0.

wp_list_categories( $args = '' )   X-Ref
Display or retrieve the HTML list of categories.

The list of arguments is below:
'show_option_all' (string) - Text to display for showing all categories.
'orderby' (string) default is 'ID' - What column to use for ordering the
categories.
'order' (string) default is 'ASC' - What direction to order categories.
'show_last_update' (bool|int) default is 0 - See {@link
walk_category_dropdown_tree()}
'show_count' (bool|int) default is 0 - Whether to show how many posts are
in the category.
'hide_empty' (bool|int) default is 1 - Whether to hide categories that
don't have any posts attached to them.
'use_desc_for_title' (bool|int) default is 1 - Whether to use the
description instead of the category title.
'feed' - See {@link get_categories()}.
'feed_type' - See {@link get_categories()}.
'feed_image' - See {@link get_categories()}.
'child_of' (int) default is 0 - See {@link get_categories()}.
'exclude' (string) - See {@link get_categories()}.
'exclude_tree' (string) - See {@link get_categories()}.
'echo' (bool|int) default is 1 - Whether to display or retrieve content.
'current_category' (int) - See {@link get_categories()}.
'hierarchical' (bool) - See {@link get_categories()}.
'title_li' (string) - See {@link get_categories()}.
'depth' (int) - The max depth.

param: string|array $args Optional. Override default arguments.
return: string HTML content only if 'echo' argument is 0.

wp_tag_cloud( $args = '' )   X-Ref
Display tag cloud.

The text size is set by the 'smallest' and 'largest' arguments, which will
use the 'unit' argument value for the CSS text size unit. The 'format'
argument can be 'flat' (default), 'list', or 'array'. The flat value for the
'format' argument will separate tags with spaces. The list value for the
'format' argument will format the tags in a UL HTML list. The array value for
the 'format' argument will return in PHP array type format.

The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.

The 'number' argument is how many tags to return. By default, the limit will
be to return the top 45 tags in the tag cloud list.

The 'topic_count_text_callback' argument is a function, which, given the count
of the posts  with that tag, returns a text for the tooltip of the tag link.

The 'exclude' and 'include' arguments are used for the {@link get_tags()}
function. Only one should be used, because only one will be used and the
other ignored, if they are both set.

param: array|string $args Optional. Override default arguments.
return: array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.

default_topic_count_text( $count )   X-Ref
Default text for tooltip for tag links

param: integer $count number of posts with that tag
return: string text for the tooltip of a tag link.

default_topic_count_scale( $count )   X-Ref
Default topic count scaling for tag links

param: integer $count number of posts with that tag
return: integer scaled count

wp_generate_tag_cloud( $tags, $args = '' )   X-Ref
Generates a tag cloud (heatmap) from provided data.

The text size is set by the 'smallest' and 'largest' arguments, which will
use the 'unit' argument value for the CSS text size unit. The 'format'
argument can be 'flat' (default), 'list', or 'array'. The flat value for the
'format' argument will separate tags with spaces. The list value for the
'format' argument will format the tags in a UL HTML list. The array value for
the 'format' argument will return in PHP array type format.

The 'tag_cloud_sort' filter allows you to override the sorting.
Passed to the filter: $tags array and $args array, has to return the $tags array
after sorting it.

The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC' or
'RAND'.

The 'number' argument is how many tags to return. By default, the limit will
be to return the entire tag cloud list.

The 'topic_count_text_callback' argument is a function, which given the count
of the posts  with that tag returns a text for the tooltip of the tag link.

param: array $tags List of tags.
param: string|array $args Optional, override default arguments.
return: string

walk_category_tree()   X-Ref
Retrieve HTML list content for category list.


walk_category_dropdown_tree()   X-Ref
Retrieve HTML dropdown (select) content for category list.


get_tag_link( $tag_id )   X-Ref
Retrieve the link to the tag.

param: int $tag_id Tag (term) ID.
return: string

get_the_tags( $id = 0 )   X-Ref
Retrieve the tags for a post.

param: int $id Post ID.
return: array

get_the_tag_list( $before = '', $sep = '', $after = '' )   X-Ref
Retrieve the tags for a post formatted as a string.

param: string $before Optional. Before tags.
param: string $sep Optional. Between tags.
param: string $after Optional. After tags.
return: string

the_tags( $before = null, $sep = ', ', $after = '' )   X-Ref
Retrieve the tags for a post.

param: string $before Optional. Before list.
param: string $sep Optional. Separate items using this.
param: string $after Optional. After list.
return: string

tag_description( $tag = 0 )   X-Ref
Retrieve tag description.

param: int $tag Optional. Tag ID. Will use global tag ID by default.
return: string Tag description, available.

term_description( $term = 0, $taxonomy = 'post_tag' )   X-Ref
Retrieve term description.

param: int $term Optional. Term ID. Will use global term ID by default.
return: string Term description, available.

get_the_terms( $id = 0, $taxonomy )   X-Ref
Retrieve the terms of the taxonomy that are attached to the post.

This function can only be used within the loop.

param: int $id Post ID. Is not optional.
param: string $taxonomy Taxonomy name.
return: array|bool False on failure. Array of term objects on success.

get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' )   X-Ref
Retrieve a post's terms as a list with specified format.

param: int $id Post ID.
param: string $taxonomy Taxonomy name.
param: string $before Optional. Before list.
param: string $sep Optional. Separate items using this.
param: string $after Optional. After list.
return: string

the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' )   X-Ref
Display the terms in a list.

param: int $id Term ID.
param: string $taxonomy Taxonomy name.
param: string $before Optional. Before list.
param: string $sep Optional. Separate items using this.
param: string $after Optional. After list.
return: null|bool False on WordPress error. Returns null when displaying.

has_tag( $tag = '', $_post = null )   X-Ref
Check if the current post has any of given tags.

The given tags are checked against the post's tags' term_ids, names and slugs.
Tags given as integers will only be checked against the post's tags' term_ids.
If no tags are given, determines if post has any tags.

Prior to v2.7 of WordPress, tags given as integers would also be checked against the post's tags' names and slugs (in addition to term_ids)
Prior to v2.7, this function could only be used in the WordPress Loop.
As of 2.7, the function can be used anywhere if it is provided a post ID or post object.

param: string|int|array $tag Optional. The tag name/term_id/slug or array of them to check for.
param: int|post object Optional.  Post to check instead of the current post. @since 2.7.0
return: bool True if the current post has any of the the given tags (or any tag, if no tag specified).



Generated: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7