Support » Theme: Twenty Sixteen » Featured image not selecting 1200px wide version

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That was a short walk. 😉

    The Twenty Sixteen theme checks if it’s functions already exist (as would any well mannered theme in 2015).

    In my child theme’s functions.php file I duplicated the twentysixteen_post_thumbnail() function.

    https://themes.trac.wordpress.org/browser/twentysixteen/0.1.20151028/inc/template-tags.php#L113

    In my copy I specified the $size as full like so the_post_thumbnail( 'full' ); and my featured images are now as I uploaded them.

    😉 Thx!

    nikaslg

    (@nikaslg)

    Can you give me more details about how to achieve bigger pictures, i dont get it, lack of knowladge

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Here you go.

    1. Create a directory in wp-content/themes named twentysixteen-child.

    2. In that new directory create a new empty file named style.css and put this in it.

    /*
    Theme Name: Twenty Sixteen Child Theme
    Description: A Twenty Sixteen Child theme that uses full sized featured images
    Version: 1.0
    Template: twentysixteen
    */

    3. In that same new directory create another new empty file named functions.php and put these lines in it.

    <?php
    
    add_action( 'wp_enqueue_scripts', 'mh_twentysixteen_child_style' , 5 );
    
    function mh_twentysixteen_child_style() {
    	wp_enqueue_style( 'twentysixteen-parent-style', get_template_directory_uri() . '/style.css' );
    }
    
    function twentysixteen_post_thumbnail() {
    	if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
    		return;
    	}
    
    	if ( is_singular() ) :
    	?>
    
    	<div class="post-thumbnail">
    		<?php the_post_thumbnail('full'); ?>
    	</div><!-- .post-thumbnail -->
    
    	<?php else : ?>
    
    	<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
    		<?php the_post_thumbnail( 'full', array( 'alt' => the_title_attribute( 'echo=0' ) ) ); ?>
    	</a>
    
    	<?php endif; // End is_singular()
    }

    The functions.php might be a bit much to copy so look at this link instead.

    http://pastebin.com/m9vJbeUY

    4. Got to your dashboard and activate the Twenty Sixteen Child Theme.

    What I’ve done is reproduce the function twentysixteen_post_thumbnail() but this time I explicitly made the post_thumbnail() ‘full’ size.

    In the child theme that function loads first. When the parent theme runs after that the same function has a check to make sure it’s not already defined. If it is (and in the child theme it is) then the function is not defined.

    nikaslg

    (@nikaslg)

    Thanks for the reply, my website is valgykimesveikiau.lt
    I cannot manage to make posts the same width as the line above, do you know how to do that, also i would like to move the left side panel to either top or bottom of the post, you seem to be good with php, do you know the solution?
    Also is there a specific way to edit the size of content blocks, like menu, posts etc?

    Thanks in advance!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    To be honest I’m not sure. Can you start a new topic with your questions? 😉

    https://wordpress.org/support/theme/twentysixteen#postform

    It’s the best way to get that looked at. This topic was about the featured image and is already sorted out.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Featured image not selecting 1200px wide version’ is closed to new replies.