get_the_date example

                $post_title   = get_the_title( $recent_post->ID );
                $title        = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' );
                $aria_current = '';

                if ( get_queried_object_id() === $recent_post->ID ) {
                    $aria_current = ' aria-current="page"';
                }
                ?> <li> <a href="<?php the_permalink( $recent_post->ID ); ?>"<?php echo $aria_current; ?>><?php echo $title; ?></a> <?php if ( $show_date ) : ?> <span class="post-date"><?php echo get_the_date( '', $recent_post->ID ); ?></span> <?php endif; ?> </li> <?php endforeach; ?> </ul> <?php         if ( 'html5' === $format ) {
            echo '</nav>';
        }

        echo $args['after_widget'];
    }

function render_block_core_post_date( $attributes$content$block ) {
    if ( ! isset( $block->context['postId'] ) ) {
        return '';
    }

    $post_ID          = $block->context['postId'];
    $formatted_date   = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format']$post_ID );
    $unformatted_date = esc_attr( get_the_date( 'c', $post_ID ) );
    $classes          = array();

    if ( isset( $attributes['textAlign'] ) ) {
        $classes[] = 'has-text-align-' . $attributes['textAlign'];
    }
    if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
        $classes[] = 'has-link-color';
    }

    /* * If the "Display last modified date" setting is enabled, * only display the modified date if it is later than the publishing date. */

    function twenty_twenty_one_posted_on() {
        $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';

        $time_string = sprintf(
            $time_string,
            esc_attr( get_the_date( DATE_W3C ) ),
            esc_html( get_the_date() )
        );
        echo '<span class="posted-on">';
        printf(
            /* translators: %s: Publish date. */
            esc_html__( 'Published %s', 'twentytwentyone' ),
            $time_string // phpcs:ignore WordPress.Security.EscapeOutput         );
        echo '</span>';
    }
}

// If on a category or tag archive, use the term title.     } elseif ( is_category() || is_tag() ) {
        $title['title'] = single_term_title( '', false );

        // If on an author archive, use the author's display name.     } elseif ( is_author() && get_queried_object() ) {
        $author         = get_queried_object();
        $title['title'] = $author->display_name;

        // If it's a date archive, use the date as the title.     } elseif ( is_year() ) {
        $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) );

    } elseif ( is_month() ) {
        $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) );

    } elseif ( is_day() ) {
        $title['title'] = get_the_date();
    }

    // Add a page number if necessary.     if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
        /* translators: %s: Page number. */
        
if ( ! empty( $author_display_name ) ) {
                $list_items_markup .= sprintf(
                    '<div class="wp-block-latest-posts__post-author">%1$s</div>',
                    $byline
                );
            }
        }

        if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) {
            $list_items_markup .= sprintf(
                '<time datetime="%1$s" class="wp-block-latest-posts__post-date">%2$s</time>',
                esc_attr( get_the_date( 'c', $post ) ),
                get_the_date( '', $post )
            );
        }

        if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
            && isset( $attributes['displayPostContentRadio'] ) && 'excerpt' === $attributes['displayPostContentRadio'] ) {

            $trimmed_excerpt = get_the_excerpt( $post );

            if ( post_password_required( $post ) ) {
                $trimmed_excerpt = __( 'This content is password protected.' );
            }
Home | Imprint | This part of the site doesn't use cookies.