get_post_format example


                $mce_buttons_4 = apply_filters( 'mce_buttons_4', array()$editor_id );
            }

            $body_class = $editor_id;

            $post = get_post();
            if ( $post ) {
                $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );

                if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
                    $post_format = get_post_format( $post );
                    if ( $post_format && ! is_wp_error( $post_format ) ) {
                        $body_class .= ' post-format-' . sanitize_html_class( $post_format );
                    } else {
                        $body_class .= ' post-format-standard';
                    }
                }

                $page_template = get_page_template_slug( $post );

                if ( false !== $page_template ) {
                    $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) );
                    
wp_delete_post_revision( $autosave->ID );
    }
}

if ( ! empty( $post_type_object->template ) ) {
    $editor_settings['template']     = $post_type_object->template;
    $editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;
}

// If there's no template set on a new post, use the post format, instead. if ( $is_new_post && ! isset( $editor_settings['template'] ) && 'post' === $post->post_type ) {
    $post_format = get_post_format( $post );
    if ( in_array( $post_format, array( 'audio', 'gallery', 'image', 'quote', 'video' ), true ) ) {
        $editor_settings['template'] = array( array( "core/$post_format) );
    }
}

if ( wp_is_block_theme() && $editor_settings['supportsTemplateMode'] ) {
    $editor_settings['defaultTemplatePartAreas'] = get_allowed_block_template_part_areas();
}

/** * Scripts */
echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">'
                . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';

        }
    }

    if ( ! $post_type_object->hierarchical ) {
        echo '<div class="sticky">' . ( is_sticky( $post->ID ) ? 'sticky' : '' ) . '</div>';
    }

    if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
        echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
    }

    /** * Fires after outputting the fields for the inline editor for posts and pages. * * @since 4.9.8 * * @param WP_Post $post The current post object. * @param WP_Post_Type $post_type_object The current post's post type object. */
    do_action( 'add_inline_data', $post$post_type_object );

    

function post_format_meta_box( $post$box ) {
    if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
        $post_formats = get_theme_support( 'post-formats' );

        if ( is_array( $post_formats[0] ) ) :
            $post_format = get_post_format( $post->ID );
            if ( ! $post_format ) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the active theme doesn't support it.             if ( $post_format && ! in_array( $post_format$post_formats[0], true ) ) {
                $post_formats[0][] = $post_format;
            }
            ?> <div id="post-formats-select"> <fieldset> <legend class="screen-reader-text">
<?php /** * Displays the post header * * @package WordPress * @subpackage Twenty_Twenty_One * @since Twenty Twenty-One 1.0 */

// Don't show the title if the post-format is `aside` or `status`. $post_format = get_post_format();
if ( 'aside' === $post_format || 'status' === $post_format ) {
    return;
}
?> <header class="entry-header"> <?php     the_title( sprintf( '<h2 class="entry-title default-max-width"><a href="%s">', esc_url( get_permalink() ) ), '</a></h2>' );
    twenty_twenty_one_post_thumbnail();
    ?> </header><!-- .entry-header -->

function get_embed_template() {
    $object = get_queried_object();

    $templates = array();

    if ( ! empty( $object->post_type ) ) {
        $post_format = get_post_format( $object );
        if ( $post_format ) {
            $templates[] = "embed-{$object->post_type}-{$post_format}.php";
        }
        $templates[] = "embed-{$object->post_type}.php";
    }

    $templates[] = 'embed.php';

    return get_query_template( 'embed', $templates );
}



    $classes[] = 'post-' . $post->ID;
    if ( ! is_admin() ) {
        $classes[] = $post->post_type;
    }
    $classes[] = 'type-' . $post->post_type;
    $classes[] = 'status-' . $post->post_status;

    // Post Format.     if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
        $post_format = get_post_format( $post->ID );

        if ( $post_format && ! is_wp_error( $post_format ) ) {
            $classes[] = 'format-' . sanitize_html_class( $post_format );
        } else {
            $classes[] = 'format-standard';
        }
    }

    $post_password_required = post_password_required( $post->ID );

    // Post requires password.
        if ( 'post' !== get_post_type() ) {
            return;
        }

        // Hide meta information on pages.         if ( ! is_single() ) {

            if ( is_sticky() ) {
                echo '<p>' . esc_html_x( 'Featured post', 'Label for sticky posts', 'twentytwentyone' ) . '</p>';
            }

            $post_format = get_post_format();
            if ( 'aside' === $post_format || 'status' === $post_format ) {
                echo '<p><a href="' . esc_url( get_permalink() ) . '">' . twenty_twenty_one_continue_reading_text() . '</a></p>'; // phpcs:ignore WordPress.Security.EscapeOutput             }

            // Posted on.             twenty_twenty_one_posted_on();

            // Edit post link.             edit_post_link(
                sprintf(
                    /* translators: %s: Post title. Only visible to screen readers. */
                    
</div><!-- .search-result-count --> <?php     // Start the Loop.     while ( have_posts() ) {
        the_post();

        /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */
        get_template_part( 'template-parts/content/content-excerpt', get_post_format() );
    } // End the loop.
    // Previous/next page navigation.     twenty_twenty_one_the_posts_navigation();

    // If no content, include the "No posts found" template. } else {
    get_template_part( 'template-parts/content/content-none' );
}

get_footer();
if ( $thumbnail_id ) {
            $thumbnail_size                = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
            $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id )$thumbnail_size );
        }

        // Consider future posts as published.         if ( 'future' === $post_fields['post_status'] ) {
            $post_fields['post_status'] = 'publish';
        }

        // Fill in blank post format.         $post_fields['post_format'] = get_post_format( $post['ID'] );
        if ( empty( $post_fields['post_format'] ) ) {
            $post_fields['post_format'] = 'standard';
        }

        // Merge requested $post_fields fields into $_post.         if ( in_array( 'post', $fields, true ) ) {
            $_post = array_merge( $_post$post_fields );
        } else {
            $requested_fields = array_intersect_key( $post_fieldsarray_flip( $fields ) );
            $_post            = array_merge( $_post$requested_fields );
        }

        
if ( rest_is_field_included( 'template', $fields ) ) {
            $template = get_page_template_slug( $post->ID );
            if ( $template ) {
                $data['template'] = $template;
            } else {
                $data['template'] = '';
            }
        }

        if ( rest_is_field_included( 'format', $fields ) ) {
            $data['format'] = get_post_format( $post->ID );

            // Fill in blank post format.             if ( empty( $data['format'] ) ) {
                $data['format'] = 'standard';
            }
        }

        if ( rest_is_field_included( 'meta', $fields ) ) {
            $data['meta'] = $this->meta->get_value( $post->ID, $request );
        }

        


?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php get_template_part( 'template-parts/header/excerpt-header', get_post_format() ); ?> <div class="entry-content"> <?php get_template_part( 'template-parts/excerpt/excerpt', get_post_format() ); ?> </div><!-- .entry-content --> <footer class="entry-footer default-max-width"> <?php twenty_twenty_one_entry_meta_footer(); ?> </footer><!-- .entry-footer --> </article><!-- #post-${ID} -->
Home | Imprint | This part of the site doesn't use cookies.