[ Index ]

WordPress Cross Reference

title

Body

[close]

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

Category Template Tags and API.

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

Defines 2 classes

Walker_Category:: (4 methods):
  start_lvl()
  end_lvl()
  start_el()
  end_el()

Walker_CategoryDropdown:: (13 methods):
  start_el()
  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_category()
  has_tag()
  has_term()

Defines 13 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()
  _wp_object_name_sort_cb()
  _wp_object_count_sort_cb()
  walk_category_tree()
  walk_category_dropdown_tree()

Class: Walker_Category  - X-Ref

Create HTML list of categories.

start_lvl( &$output, $depth = 0, $args = array()   X-Ref
Starts the list before the elements are added.

param: string $output Passed by reference. Used to append additional content.
param: int    $depth  Depth of category. Used for tab indentation.
param: array  $args   An array of arguments. Will only append content if style argument value is 'list'.

end_lvl( &$output, $depth = 0, $args = array()   X-Ref
Ends the list of after the elements are added.

param: string $output Passed by reference. Used to append additional content.
param: int    $depth  Depth of category. Used for tab indentation.
param: array  $args   An array of arguments. Will only append content if style argument value is 'list'.

start_el( &$output, $category, $depth = 0, $args = array()   X-Ref
Start the element output.

param: string $output   Passed by reference. Used to append additional content.
param: object $category Category data object.
param: int    $depth    Depth of category in reference to parents. Default 0.
param: array  $args     An array of arguments. @see wp_list_categories()
param: int    $id       ID of the current category.

end_el( &$output, $page, $depth = 0, $args = array()   X-Ref
Ends the element output, if needed.

param: string $output Passed by reference. Used to append additional content.
param: object $page   Not used.
param: int    $depth  Depth of category. Not used.
param: array  $args   An array of arguments. Only uses 'list' for whether should append to output. @see wp_list_categories()

Class: Walker_CategoryDropdown  - X-Ref

Create HTML dropdown list of Categories.

start_el( &$output, $category, $depth = 0, $args = array()   X-Ref
Start the element output.

param: string $output   Passed by reference. Used to append additional content.
param: object $category Category data object.
param: int    $depth    Depth of category. Used for padding.
param: array  $args     Uses 'selected' and 'show_count' keys, if they exist. @see wp_dropdown_categories()

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

param: int|object $tag Tag ID or object.
return: string Link on success, empty string if tag does not exist.

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

param: int $id Post ID.
return: array|bool Array of tag objects on success, false on failure.

get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 )   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.
param: int $id Optional. Post ID. Defaults to the current post.
return: string|bool|WP_Error A list of tags on success, false or WP_Error on failure.

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.

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.
param: string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
return: string Term description, available.

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

param: int|object $post Post ID or object.
param: string $taxonomy Taxonomy name.
return: array|bool|WP_Error Array of term objects on success, false or WP_Error on failure.

get_the_term_list( $id, $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|bool|WP_Error A list of terms on success, false or WP_Error on failure.

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

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: null|bool False on WordPress error. Returns null when displaying.

has_category( $category = '', $post = null )   X-Ref
Check if the current post has any of given category.

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

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|object $post Optional. Post to check instead of the current post. (since 2.7.0)
return: bool True if the current post has any of the given tags (or any tag, if no tag specified).

has_term( $term = '', $taxonomy = '', $post = null )   X-Ref
Check if the current post has any of given terms.

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

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

Functions
Functions that are not part of a class:

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

param: int|object $category Category ID or object.
return: string Link on success, empty string if category does not exist.

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|WP_Error A list of category parents on success, WP_Error on failure.

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|WP_Error Category name on success, WP_Error on failure.

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|object $post 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_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 select element.
'id' (string) - The ID attribute value for select element. Defaults to name if omitted.
'class' (string) - The class attribute value for select element.
'selected' (int) - Which category ID is selected.
'taxonomy' (string) - The name of the taxonomy to retrieve. Defaults to category.

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

_wp_object_name_sort_cb( $a, $b )   X-Ref
Callback for comparing objects based on name


_wp_object_count_sort_cb( $a, $b )   X-Ref
Callback for comparing objects based on count


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.




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