WordPress Tools: MW Get Post Info
The function mw_get_post_info
can return any or all of the word and image counts, a list of the post's categories, and comment/ping status for current post. Accepts two parameters: a series of letters that define the order of what's shown, and the separator character to put between each of the bits of information. Also contains the function the_plain_categories
, which returns the post categories in plain text with an optional separator.
- Version: 1.0.1
- Date: 9 July 2004
- Download: mw_get_post_info.php
Functional Reference
<?php mw_get_post_info('show', 'separator') ?>
show
(string)-
The contents of this string control what bits of information ("infobits") are returned, and in what order. Each bit is represented by a single letter. The recognized letters are:
W
— The word count of the post content.I
— The image count of the post content. If there are no images, nothing is returned at this point, including the trailing separator.C
— The categories to which the post belongs as plain-text space-separated words.R
— The "response status" of the post. Indicates which of comments or pings (or both) are allowed, or if no reponses of any kind are allowed.
'show'
is'WIR'
then the returned infobits will be the word count, then the image count (if any), and finally the response status. Reversing the letters will reverse the order in which the infobits are returned. These infobits are separated by a vertical bar by default, but this can be modified (seeseparator
, below). Defaults to'WICR'
. separator
(string)-
A string that is inserted after each bit of information except the last one. This can be any string, including character entities and Unicode references. Note that Unicode support is not universal, so test thoroughly. Defaults to
' | '
(a vertical bar with one space to either side).
<?php the_plain_categories('separator') ?> {
separator
(string)-
A string that is inserted after each category name except the last one. This can be any string, including character entities and Unicode references. Note that Unicode support is not universal, so test thoroughly. Defaults to
' '
(single space).