get_the_permalink example

if ( ! $title ) {
        return '';
    }

    $tag_name = 'h2';
    if ( isset( $attributes['level'] ) ) {
        $tag_name = 'h' . $attributes['level'];
    }

    if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
        $rel   = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
        $title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', get_the_permalink( $block->context['postId'] )esc_attr( $attributes['linkTarget'] )$rel$title );
    }

    $classes = array();
    if ( isset( $attributes['textAlign'] ) ) {
        $classes[] = 'has-text-align-' . $attributes['textAlign'];
    }
    if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
        $classes[] = 'has-link-color';
    }
    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );

    
$featured_image = get_the_post_thumbnail( $post_ID$size_slug$attr );
    if ( ! $featured_image ) {
        return '';
    }
    if ( $is_link ) {
        $link_target    = $attributes['linkTarget'];
        $rel            = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
        $height         = ! empty( $attributes['height'] ) ? 'style="' . esc_attr( safecss_filter_attr( 'height:' . $attributes['height'] ) ) . '"' : '';
        $featured_image = sprintf(
            '<a href="%1$s" target="%2$s" %3$s %4$s>%5$s%6$s</a>',
            get_the_permalink( $post_ID ),
            esc_attr( $link_target ),
            $rel,
            $height,
            $featured_image,
            $overlay_markup
        );
    } else {
        $featured_image = $featured_image . $overlay_markup;
    }

    $aspect_ratio = ! empty( $attributes['aspectRatio'] )
        ?
$screen_reader_text = sprintf(
        /* translators: %s is either the post title or post ID to describe the link for screen readers. */
        __( ': %s' ),
        $post_title
    );
    $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
    $more_text          = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' );
    return sprintf(
        '<a %1s href="%2s" target="%3s">%4s<span class="screen-reader-text">%5s</span></a>',
        $wrapper_attributes,
        get_the_permalink( $post_ID ),
        esc_attr( $attributes['linkTarget'] ),
        $more_text,
        $screen_reader_text
    );
}

/** * Registers the `core/read-more` block on the server. */
function register_block_core_read_more() {
    register_block_type_from_metadata(
        
$formatted_date   = get_the_modified_date( empty( $attributes['format'] ) ? '' : $attributes['format']$post_ID );
            $unformatted_date = esc_attr( get_the_modified_date( 'c', $post_ID ) );
            $classes[]        = 'wp-block-post-date__modified-date';
        } else {
            return '';
        }
    }

    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );

    if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
        $formatted_date = sprintf( '<a href="%1s">%2s</a>', get_the_permalink( $post_ID )$formatted_date );
    }

    return sprintf(
        '<div %1$s><time datetime="%2$s">%3$s</time></div>',
        $wrapper_attributes,
        $unformatted_date,
        $formatted_date
    );
}

/** * Registers the `core/post-date` block on the server. */

    $excerpt_length = $attributes['excerptLength'];
    $excerpt        = get_the_excerpt( $block->context['postId'] );
    if ( isset( $excerpt_length ) ) {
        $excerpt = wp_trim_words( $excerpt$excerpt_length );
    }

    $more_text           = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . wp_kses_post( $attributes['moreText'] ) . '</a>' : '';
    $filter_excerpt_more = static function( $more ) use ( $more_text ) {
        return empty( $more_text ) ? $more : '';
    };
    /** * Some themes might use `excerpt_more` filter to handle the * `more` link displayed after a trimmed excerpt. Since the * block has a `more text` attribute we have to check and * override if needed the return value from this filter. * So if the block's attribute is not empty override the * `excerpt_more` filter and return nothing. This will * result in showing only one `read more` link at a time. */

function _wp_dashboard_recent_comments_row( &$comment$show_date = true ) {
    $GLOBALS['comment'] = clone $comment;

    if ( $comment->comment_post_ID > 0 ) {
        $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
        $comment_post_url   = get_the_permalink( $comment->comment_post_ID );
        $comment_post_link  = '<a href="' . esc_url( $comment_post_url ) . '">' . $comment_post_title . '</a>';
    } else {
        $comment_post_link = '';
    }

    $actions_string = '';
    if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
        // Pre-order it: Approve | Reply | Edit | Spam | Trash.         $actions = array(
            'approve'   => '',
            'unapprove' => '',
            
?> </div><!-- .entry-content --> <footer class="entry-footer default-max-width"> <?php             // Check if there is a parent, then add the published in link.             if ( wp_get_post_parent_id( $post ) ) {
                echo '<span class="posted-on">';
                printf(
                    /* translators: %s: Parent post. */
                    esc_html__( 'Published in %s', 'twentytwentyone' ),
                    '<a href="' . esc_url( get_the_permalink( wp_get_post_parent_id( $post ) ) ) . '">' . esc_html( get_the_title( wp_get_post_parent_id( $post ) ) ) . '</a>'
                );
                echo '</span>';
            } else {
                // Edit post link.                 edit_post_link(
                    sprintf(
                        /* translators: %s: Post title. Only visible to screen readers. */
                        esc_html__( 'Edit %s', 'twentytwentyone' ),
                        '<span class="screen-reader-text">' . get_the_title() . '</span>'
                    ),
                    '<span class="edit-link">',
                    
Home | Imprint | This part of the site doesn't use cookies.