Post title and meta above featured image (but not on Posts page)

Hey guys,

I wanted to change the order of my Title and Featured image on my blog. I found some helpful posts in the forum already, and uploaded a new content.php file to my child theme.

So now the order is correct. (Example here: https://jayclouse.com/lessons-learned-in-2019/)

But I didn’t want to change the way the Posts page rendered: https://jayclouse.com/journal/

How can I amend this so that this page still has title and meta on the right side, above the content? Example on another one of my sites: https://unrealcollective.com/blog/

For reference, this is the code in content.php:

<?php

// =============================================================================
// VIEWS/ETHOS/CONTENT.PHP
// -----------------------------------------------------------------------------
// Standard post output for Ethos.
// =============================================================================

$is_index_featured_layout = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout',  true ) == 'on' && ! is_single();

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
  <?php if ( $is_index_featured_layout ) : ?>
    <?php x_ethos_featured_index(); ?>
  <?php else : ?>
    <?php if ( has_post_thumbnail() ) : ?>
      <div class="entry-featured">
        <?php if ( ! is_single() ) : ?>
          <?php x_ethos_featured_index(); ?>
        <?php else : ?>
          <?php x_featured_image(); ?>
        <?php endif; ?>
      </div>
    <?php endif; ?>
    <div class="entry-wrap">
      
      <?php x_get_view( 'global', '_content' ); ?>
    </div>
  <?php endif; ?>
</article>

Hello @jayclouse,

Thanks for the very detailed post information.

You will need to add a condition in the code so that the change of the order will only happen when viewing a single blog post. Please update your code and use this instead:

<?php

// =============================================================================
// VIEWS/ETHOS/CONTENT.PHP
// -----------------------------------------------------------------------------
// Standard post output for Ethos.
// =============================================================================

$is_index_featured_layout = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout',  true ) == 'on' && ! is_single();

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

  <?php if ( is_single() ) : ?>
    <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
  <?php endif; ?>

  <?php if ( $is_index_featured_layout ) : ?>
    <?php x_ethos_featured_index(); ?>
  <?php else : ?>
    <?php if ( has_post_thumbnail() ) : ?>
      <div class="entry-featured">
        <?php if ( ! is_single() ) : ?>
          <?php x_ethos_featured_index(); ?>
        <?php else : ?>
          <?php x_featured_image(); ?>
        <?php endif; ?>
      </div>
    <?php endif; ?>
    <div class="entry-wrap">
      
      <?php if ( !is_single() ) : ?>
        <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
      <?php endif; ?>
      
      <?php x_get_view( 'global', '_content' ); ?>
    </div>
  <?php endif; ?>
</article>

We would love to know if this has worked for you. Thank you.

That did the trick! Thank you!

You’re always welcome @jayclouse!
Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.