• Hello all,

    I have already Googled around to find out how to move the featured image of a post to display below the title, but all the answers I found were specific to certain themes and aren’t working for me.

    I am using the Nano theme and have created a child already. But I can’t figure out which code to switch around. I tried a few things and it didn’t work, would really appreciate any guidance.

    This is what my content.php file looks like. According to the other threads I’ve seen I should be able to move the title section above the thumbnail section, but my php knowledge is not good enough to know exactly which sections go together.

    <?php
    /**
     * @package Nano
     */
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<?php if ( has_post_thumbnail( $post->ID ) ) { ?>
    		<div class="entry-thumbnail">
    			<?php if ( has_post_thumbnail( $post->ID ) ) { ?>
    				<?php if ( is_single() ) { ?>
    					<?php
    					$attachment_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
    					$image_url = ( $attachment_url ) ? $attachment_url[0] : '';
    					?>
    					<a href="<?php echo $image_url; ?>" class="wrapper-overlay prettyphoto" title="<?php __( 'Large View', 'nano' ); ?>" rel="bookmark"><?php the_post_thumbnail( 'full' ); ?><span class="img-overlay"></span><span class="icon icon-zoom-in"></span></a>
    				<?php } else { ?>
    					<a href="<?php the_permalink(); ?>" class="wrapper-overlay" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'nano' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'full' ); ?><span class="img-overlay">&nbsp;</span><span class="icon icon-external-link"></span></a>
    				<?php } ?>
    			<?php } ?>
    		</div>
    		<?php } ?>
    		<h1 class="entry-title">
    			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    		</h1>
    
    		<?php
    		if ( 'post' == get_post_type() ) {
    			nano_post_top_info();
    		}
    		?>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php
    		if ( is_single() ) {
    			the_content();
    			wp_link_pages( array(
    				'before' => '<div class="page-links">' . __( 'Pages:', 'nano' ),
    				'after'  => '</div>',
    			) );
    		} else {
    			the_content();
    		}
    		?>
    	</div><!-- .entry-content -->
    
    	<footer class="entry-meta group">
    		<?php nano_meta(); ?>
    	</footer><!-- .entry-meta -->
    </article><!-- #post-## -->

    Any help would be really appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ashleyrclark

    (@ashleyrclark)

    Also tried moving bits around in the single-post.php file and no luck there :/

    Hey Ashley,

    this should be your code

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<h1 class="entry-title">
    			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    		</h1>
    		<?php if ( has_post_thumbnail( $post->ID ) ) { ?>
    		<div class="entry-thumbnail">
    			<?php if ( has_post_thumbnail( $post->ID ) ) { ?>
    			<?php if ( is_single() ) { ?>
    			<?php
    			$attachment_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
    			$image_url = ( $attachment_url ) ? $attachment_url[0] : '';
    			?>
    			<a href="<?php echo $image_url; ?>" class="wrapper-overlay prettyphoto" title="<?php __( 'Large View', 'nano' ); ?>" rel="bookmark"><?php the_post_thumbnail( 'full' ); ?><span class="img-overlay"></span><span class="icon icon-zoom-in"></span></a>
    			<?php } else { ?>
    			<a href="<?php the_permalink(); ?>" class="wrapper-overlay" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'nano' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'full' ); ?><span class="img-overlay">&nbsp;</span><span class="icon icon-external-link"></span></a>
    			<?php } ?>
    			<?php } ?>
    		</div>
    		<?php } ?>
    
    		<?php
    		if ( 'post' == get_post_type() ) {
    			nano_post_top_info();
    		}
    		?>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php
    		if ( is_single() ) {
    			the_content();
    			wp_link_pages( array(
    				'before' => '<div class="page-links">' . __( 'Pages:', 'nano' ),
    				'after'  => '</div>',
    				) );
    		} else {
    			the_content();
    		}
    		?>
    	</div><!-- .entry-content -->
    
    	<footer class="entry-meta group">
    		<?php nano_meta(); ?>
    	</footer><!-- .entry-meta -->
    </article><!-- #post-## -->

    Hope this helps
    -Connie Green

    Thread Starter ashleyrclark

    (@ashleyrclark)

    Hi Connie,

    Thanks very much for your help. Unfortunately I put that code in – in place of the code I had – and it didn’t change anything. The featured image persists in displaying above the title of the post.

    Is it possible there is some other code elsewhere that is locking the order in place? I poked around a little, and the only other thing I found which might be related is single-post.php.

    <?php
    /**
     * The Template for displaying all single posts.
     *
     * @package Nano
     */
    
    global $data;
    get_header(); ?>
    
    	<div class="row">
    		<div id="main" class="column medium-8">
    
    		<?php while ( have_posts() ) : the_post();
    
    			get_template_part( 'content', get_post_format() );
    
    			if ( 1 === $data['enable_author_info_box'] )
    				nano_print_author_info();
    
    			nano_content_nav( 'nav-below' );
    
    			if ( 1 === $data['enable_related_posts'] )
    				echo nano_related_posts();
    
    			// If comments are open or we have at least one comment, load up the comment template
    			if ( comments_open() || '0' != get_comments_number() )
    				comments_template();
    
    		endwhile; // end of the loop. ?>
    
    		</div><!-- end #main -->
    
    		<?php get_sidebar(); ?>
    
    	</div><!-- end row -->
    <?php get_footer(); ?>

    As an alternative solution, I would be happy to learn how to simply block the featured image from showing at all on posts. I want to be able to set it so that it shows up as the post’s thumbnail, but it doesn’t need to show up in the post – I can simply manually insert it.

    Ashley, is it possible to have the URL of the site to give it a look?

    Thread Starter ashleyrclark

    (@ashleyrclark)

    Sure it’s https://mihnyc.com

    I’m sorry but as you appear to be using a non-WPORG theme, you need to seek support from the theme’s developers – paid or otherwise. We only support themes downloaded from www.remarpro.com here.

    Thread Starter ashleyrclark

    (@ashleyrclark)

    Ah okay, I did not realize that the support was limited to WPORG.
    I’ve already contacted the developer, but no luck so far.
    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Move featured image below post title – Nano’ is closed to new replies.