# uicore-elements/1.3.17/includes/widgets/theme-builder/post-meta.php

UiCore Elements – Free widgets and templates for Elementor, version 1.3.17. 183 lines.

- Page: https://pluginprobe.com/plugins/uicore-elements/1.3.17/code/includes/widgets/theme-builder/post-meta.php
- Raw: https://pluginprobe.com/plugins/uicore-elements/1.3.17/raw/includes/widgets/theme-builder/post-meta.php
- Modified: 2026-09-15T12:03:04+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/uicore-elements/1.3.17/code/includes/widgets/theme-builder/post-meta.php#L10-L20`.

```php
<?php

namespace UiCoreElements\Widgets\ThemeBuilder;

use UiCoreElements\UiCoreWidget;
use Elementor\Controls_Manager;
use UiCoreElements\Utils\Meta_Trait;
use UiCoreElements\Helper;

defined('ABSPATH') || exit();

/**
 * The Title widget.
 *
 * @since 1.0.0
 */
class PostMeta extends UiCoreWidget
{

    use Meta_Trait;

    public function get_name()
    {
        return 'uicore-post-meta';
    }
    public function get_title()
    {
        return esc_html__('Post Meta', 'uicore-elements');
    }
    public function get_icon()
    {
        return 'eicon-post-info ui-e-widget';
    }
    public function get_categories()
    {
        return ['uicore', 'uicore-theme-builder'];
    }
    public function get_styles()
    {
        return ['post-meta'];
    }
    public function get_scripts()
    {
        return [];
    }
    public function get_keywords()
    {
        return ['post', 'meta', 'info'];
    }
    public function has_widget_inner_wrapper(): bool
    {
        // TODO: remove after Optmized Markup experiment is merged to the core
        return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
    }

    protected function register_controls()
    {
        $this->start_controls_section(
            'section_content',
            [
                'label' => esc_html__('Content', 'uicore-elements'),
            ]
        );

        $this->add_control(
            'meta_list',
            [
                'label' => esc_html__('Meta Data', 'uicore-elements'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => $this->get_meta_content_controls(),
                'default' => [
                    [
                        'type' => 'author'
                    ],
                ],
                'title_field' => '<span style="text-transform: capitalize">{{{ type }}}</span>',
                'prevent_empty' => false,
                'separator' => 'before'
            ]
        );
        $this->add_responsive_control(
            'content_align',
            [
                'label' => esc_html__('Content Alignment', 'uicore-elements'),
                'type' => Controls_Manager::CHOOSE,
                'options' => [
                    'left' => [
                        'title' => esc_html__('Left', 'uicore-elements'),
                        'icon' => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__('Center', 'uicore-elements'),
                        'icon' => 'eicon-text-align-center',
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}}' => 'text-align: {{VALUE}};',
                ],
            ]
        );
        $this->end_controls_section();

        $this->start_controls_section(
            'section_meta_style',
            [
                'label' => esc_html__('Style', 'uicore-elements'),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        $this->get_meta_style_controls();
        $this->end_controls_section();
    }

    protected function display_dummy_text($meta_list)
    {
        echo '<div class="ui-e-post-meta ui-e-tb-meta">';
        foreach ($meta_list as $meta) {
            if ($meta['type'] != 'none') {

                $dummy_content = [
                    'excerpt' => esc_html__('This is a sample post excerpt. It provides a brief summary of the article, giving readers a quick preview of the content before they click through to read the full post.', 'uicore-elements'),
                    'comment' => rand(1, 5),
                    'reading time' => rand(1, 5)
                ];

                // Print dummy content, if available
                if (array_key_exists($meta['type'], $dummy_content)) {
                    $content = $dummy_content[$meta['type']];

                    // The content printing is the same from display_meta() and should follow up future changes
                    $wrapper = '<div class="ui-e-meta-item">';
                    $prefix  = $meta['before'] ? '<span>' . esc_html($meta['before']) . '</span>' : '';
                    $suffix  = $meta['after'] ? '<span class="ui-e-meta-after">' . esc_html($meta['after']) . '</span>' : '';

                    ob_start();
                    \Elementor\Icons_Manager::render_icon($meta['icon'], ['aria-hidden' => 'true', 'class' => 'ui-e-meta-icon'], 'span');
                    $icon = ob_get_clean();

                    if (!empty($content)) {
                        echo $wrapper . Helper::esc_svg($icon) . $prefix . $content . $suffix . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                    }
                } else {
                    $this->display_meta($meta);
                }

                if (next($meta_list) && $this->get_settings_for_display('tb-meta_meta_separator')) {
                    echo '<span class="ui-e-separator">' . esc_html($this->get_settings_for_display('tb-meta_meta_separator')) . '</span>';
                }
            }
        }
        echo '</div>';
    }

    protected function render()
    {
        $meta_list = $this->get_settings_for_display('meta_list');

        if (!isset($meta_list[0]) || $meta_list[0]['type'] == '') {
            return;
        }

        if ($this->is_edit_mode()) {
            $this->display_dummy_text($meta_list);
            return;
        }

        echo '<div class="ui-e-post-meta ui-e-tb-meta">';
        foreach ($meta_list as $meta) {
            if ($meta['type'] != 'none') {
                $this->display_meta($meta);

                if (next($meta_list) && $this->get_settings_for_display('tb-meta_meta_separator')) {
                    echo '<span class="ui-e-separator">' . esc_html($this->get_settings_for_display('tb-meta_meta_separator')) . '</span>';
                }
            }
        }
        echo '</div>';
    }

    protected function content_template() {}
}
\Elementor\Plugin::instance()->widgets_manager->register(new PostMeta());

```
