meyerweb.com

Skip to: site navigation/presentation
Skip to: Thoughts From Eric

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.

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.
Thus, if the value passed for '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 (see separator, 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).

Identity Archipelago

Projects Elsewhere

Redesign Watch

archive

Extras