# wp-ultimate-post-grid/1.7.2/addons/custom-templates/templates/post/date.php

WP Ultimate Post Grid, version 1.7.2. 31 lines.

- Page: https://pluginprobe.com/plugins/wp-ultimate-post-grid/1.7.2/code/addons/custom-templates/templates/post/date.php
- Raw: https://pluginprobe.com/plugins/wp-ultimate-post-grid/1.7.2/raw/addons/custom-templates/templates/post/date.php
- Modified: 2015-09-29T13:38:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-ultimate-post-grid/1.7.2/code/addons/custom-templates/templates/post/date.php#L10-L20`.

```php
<?php

class WPUPG_Template_Post_Date extends WPUPG_Template_Block {

    public $format;

    public $editorField = 'postDate';

    public function __construct( $type = 'post-date' )
    {
        parent::__construct( $type );
    }

    public function format( $format )
    {
        $this->format = $format;
        return $this;
    }


    public function output( $post, $args = array() )
    {
        if( !$this->output_block( $post, $args ) ) return '';

        $output = $this->before_output();

        $output .= '<span' . $this->style() . '>' . get_the_date( $this->format, $post->ID ) . '</span>';

        return $this->after_output( $output, $post );
    }
}
```
