get_template_part example



get_header();

/* Start the Loop */
while ( have_posts() ) :
    the_post();

    get_template_part( 'template-parts/content/content-single' );

    if ( is_attachment() ) {
        // Parent post navigation.         the_post_navigation(
            array(
                /* translators: %s: Parent post link. */
                'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><span class="post-title">%s</span>', 'twentytwentyone' ), '%title' ),
            )
        );
    }

    


$wrapper_classes  = 'site-header';
$wrapper_classes .= has_custom_logo() ? ' has-logo' : '';
$wrapper_classes .= ( true === get_theme_mod( 'display_title_and_tagline', true ) ) ? ' has-title-and-tagline' : '';
$wrapper_classes .= has_nav_menu( 'primary' ) ? ' has-menu' : '';
?> <header id="masthead" class="<?php echo esc_attr( $wrapper_classes ); ?>"> <?php get_template_part( 'template-parts/header/site-branding' ); ?> <?php get_template_part( 'template-parts/header/site-nav' ); ?> </header><!-- #masthead -->
</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();
<?php if ( have_posts() ) : ?> <header class="page-header alignwide"> <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> <?php if ( $description ) : ?> <div class="archive-description"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> <?php endif; ?> </header><!-- .page-header --> <?php while ( have_posts() ) : ?> <?php the_post(); ?> <?php get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) ); ?> <?php endwhile; ?> <?php twenty_twenty_one_the_posts_navigation(); ?> <?php else : ?> <?php get_template_part( 'template-parts/content/content-none' ); ?> <?php endif; ?> <?php get_footer();


?> </main><!-- #main --> </div><!-- #primary --> </div><!-- #content --> <?php get_template_part( 'template-parts/footer/footer-widgets' ); ?> <footer id="colophon" class="site-footer"> <?php if ( has_nav_menu( 'footer' ) ) : ?> <nav aria-label="<?php esc_attr_e( 'Secondary menu', 'twentytwentyone' ); ?>" class="footer-navigation"> <ul class="footer-navigation-wrapper"> <?php                     wp_nav_menu(
                        array(
                            'theme_location' => 'footer',
                            'items_wrap'     => '%3$s',
                            


?> <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} -->


get_header( 'embed' );

if ( have_posts() ) :
    while ( have_posts() ) :
        the_post();
        get_template_part( 'embed', 'content' );
    endwhile;
else :
    get_template_part( 'embed', '404' );
endif;

get_footer( 'embed' );


get_header();

/* Start the Loop */
while ( have_posts() ) :
    the_post();
    get_template_part( 'template-parts/content/content-page' );

    // If comments are open or there is at least one comment, load up the comment template.     if ( comments_open() || get_comments_number() ) {
        comments_template();
    }
endwhile; // End of the loop.
get_footer();


?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( ! is_front_page() ) : ?> <header class="entry-header alignwide"> <?php get_template_part( 'template-parts/header/entry-header' ); ?> <?php twenty_twenty_one_post_thumbnail(); ?> </header><!-- .entry-header --> <?php elseif ( has_post_thumbnail() ) : ?> <header class="entry-header alignwide"> <?php twenty_twenty_one_post_thumbnail(); ?> </header><!-- .entry-header --> <?php endif; ?> <div class="entry-content"> <?php         the_content();

        
<?php body_class(); ?>> <?php wp_body_open(); ?> <div id="page" class="site"> <a class="skip-link screen-reader-text" href="#content"> <?php         /* translators: Hidden accessibility text. */
        esc_html_e( 'Skip to content', 'twentytwentyone' );
        ?> </a> <?php get_template_part( 'template-parts/header/site-header' ); ?> <div id="content" class="site-content"> <div id="primary" class="content-area"> <main id="main" class="site-main">
<?php single_post_title(); ?></h1> </header><!-- .page-header --> <?php endif; ?> <?php if ( have_posts() ) {

    // Load posts loop.     while ( have_posts() ) {
        the_post();

        get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) );
    }

    // Previous/next page navigation.     twenty_twenty_one_the_posts_navigation();

} else {

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

}

'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
            )
        );
        ?> </div><!-- .entry-content --> <footer class="entry-footer default-max-width"> <?php twenty_twenty_one_entry_meta_footer(); ?> </footer><!-- .entry-footer --> <?php if ( ! is_singular( 'attachment' ) ) : ?> <?php get_template_part( 'template-parts/post/author-bio' ); ?> <?php endif; ?> </article><!-- #post-<?php the_ID(); ?> -->
Home | Imprint | This part of the site doesn't use cookies.