Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:DavePar/Plugin API/the date

Description

Used to change the appearance of the date when the_date() is called from a theme.

Prototype

 the_date($content, $format, $before, $after) 

Examples

Will boldface just the date in the string:

add_filter('the_date', array('foo_bar', 'the_date_filter'), 10, 4);

class foo_bar {
    function the_date_filter($content, $format, $before, $after) {
        if ($content != '') {
            if ($after != '') {
                $content = substr($content, strlen($before), -strlen($after));
            }
            else {
                $content = substr($content, strlen($before));
            }
            $content = $before . "<strong>$content</strong>" . $after;
        }
        return $content
    }
}

Parameters

content
The date content after the normal processing has been applied (e.g. formatted according to $format, and $before and $after added).
format
The format for the date passed to the_date template tag. See Formatting Date and Time.
before
Text to place before the date, as passed to the_date template tag.
after
Text to place after the date, as passed to the_date template tag.

Related

See the_date().