I have a post part that is called into my single.php and looks like this:
<div class="main-content col-md-8" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
</div> <!-- end .main-content -->
<?php get_sidebar(); ?> // col-md-4
Then my content.php looks like this:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php if ( is_single() ) : ?>
<h1><?php the_title(); ?></h1>
<?php else: ?>
<h1><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php endif; ?>
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<figure class="entry-thumbnail">
<?php the_post_thumbnail( 'post-large' ); ?>
</figure>
<?php endif; ?>
<div class="entry-meta">
<?php
// Display the meta information
my_theme_post_meta();
?>
</div>
</header> <!-- end entry-header -->
<div class="entry-content">
<?php
if ( is_search() ) {
the_excerpt();
} else {
the_content( __( 'Continue reading →', 'my_theme' ) );
wp_link_pages();
}
?>
</div> <!-- end entry-content -->
</article>
Now, I want to create another part just like the first block of code(col-md-8 and sidebar col-md-4) where I would have my post content and sidebar but I want to have my post thumbnail and post meta full width(col-md-12) above that block.
In that case I am wondering how to tweak my code on content.php where the post thumbnail and post meta are called in order to have them displaying above my col-md-8 and sidebar(col-md-4) only for this specific situation.
A solution would be to have a col-md-12 div above my col-md-8 div and sidebar and add my post thumbnail and post meta code there but then these would be outside the loop and I wouldn't be able to use content.php for this situation and I would like to use content.php for all my post layout variations for easier maintenance. And having the post thumbnail and post meta code on their own on a div col-md-12 outside the loop would not be ideal as I need to access the post meta for each specific post.. So, just wondering what would be the ideal solution to achieve this.