WordPress.org

Ready to get started?Download WordPress

Forums

Untitled
[resolved] Featured Image Problems (18 posts)

  1. Brooke972
    Member
    Posted 4 months ago #

    I originally had the featured image and the slider working on my page. It would display the whole image and looked great. But now it crops the image. I tried changing the picture and the pixel options. All my images are 1040x440 or bigger. How can I fix this?

    This is my website:
    http://www.proyectogtg.com/

  2. Think about what you have you changed since the slider images were the right size. Have you touched any of the theme files or CSS?

    You could try regenerating your images using a plugin like Regenerate Thumbnails.

    Let me know how it goes.

  3. Brooke972
    Member
    Posted 4 months ago #

    Alright I fixed this problem by going back to the Twenty-Fourteen theme and adding the images in there and then changing back to the Untitled theme. They showed full size then. Before that, I tried the regenerate thumbnails and all the images that were full sized were cropped down to an awkward size.

    If you go to my website now, the majority of the images are cropped weird again. This happened after my homepage slider disappeared. I clicked to have it not displayed and clicked again to have it display again, but when it reappeared the images were cropped down.

    What should I try? I'd much rather not have to change themes to set a featured image but I really want full sized images.

  4. I noticed a few things about some of your images:

    - Some are smaller than the 1024px minimum needed for the slider. For example, this one is only 720px wide:

    http://i0.wp.com/www.proyectogtg.com/wp-content/uploads/2014/02/1523153_672237359495929_808004782_o.jpg

    - Some images are not in your Media Library. For example, the image above is being hotlinked from WordPress.com.

    All slider images will need to be in your Media Library for the resizing the theme does to work correctly. They'll also need to be at least 1024px wide, and ideally at least 1440px X 400px.

    After uploading new copies of the images that are currently either too small or not in your media library, you'll need to regenerate thumbnails again.

    Let me know how it goes.

  5. Brooke972
    Member
    Posted 4 months ago #

    There is no way then to get the full sized images in better quality?

    Because if the ratio is less than 1024 x 400 it blows the image up to a full sized image on the page. However quality is lost.

    If the image is larger, the image is cropped. For example, this image is 1280 × 719 and it is cropped. Can I not get that image to be full sized?

    http://www.proyectogtg.com/2014/03/20/que-buscan-las-mujeres-en-un-hombre/

  6. The size of those images is set through functions.php, on line 46:

    add_image_size( 'slider-img', 1440, 400, true );

    What you can do if you'd like the images to be taller is to create a child theme with a functions.php file that specifies a larger height.

    Making a child theme means your changes won't be overwritten when you update the theme. If you're new to child themes, you can explore these guides:

    http://codex.wordpress.org/Child_Themes
    http://op111.net/53/
    http://vimeo.com/49770088

    1. Once you've set up your child theme folder, create a blank plain-text file and name it functions.php.

    2. Add this code to the file:

    <?php
    if ( ! function_exists( 'untitled_setup' ) ) :
    
    function untitled_setup() {
    	add_image_size( 'slider-img', 1440, 700, true );
    }
    endif; // untitled_setup
    
    add_action( 'after_setup_theme', 'untitled_setup' );
    ?>

    You can change 700 to whatever you want your new height to be.

    Be sure there are no blank lines before and after the code in your child theme's functions.php.

    3. After uploading and activating your child theme, you'll need to regenerate your thumbnails again.

    I tested this on my end and it works - let me know it goes.

    I also realized why it looks like your images are coming from WordPress.com - you're using Photon. :-) So disregard my earlier comment about the Media Library.

  7. Brooke972
    Member
    Posted 4 months ago #

    Wow! That made my day! It works! Thank you so much.

    Since doing this, however, there is a problem with adding featured images to new posts. On the "Edit a Post" page, usually near the bottom of the page is where you add the featured image and also where you can tag it to put it in the slider. But since adding the child theme, it only shows that I can add a tag but can't add a featured image.

    Again, thank you so much.

  8. Ah - my mistake, sorry about that. You will actually need to copy the entire function over from the parent theme's functions.php, from lines 16:

    if ( ! function_exists( 'untitled_setup' ) ) :

    and include everything after that, straight through to line 64:

    add_action( 'after_setup_theme', 'untitled_setup' );

    Make the same 700px change (or whatever you like) that you did earlier. Wrap the page in opening and closing PHP tags as you did earlier.

    That should do the trick - let me know how it goes.

  9. Brooke972
    Member
    Posted 3 months ago #

    I copied:

    <?php
    if ( ! function_exists( 'untitled_setup' ) ) :
    
    function untitled_setup() {
    	add_image_size( 'slider-img', 1440, 700, true );
    }
    endif; // untitled_setup
    
    add_action( 'after_setup_theme', 'untitled_setup' );
    ?>

    over the lines 16-64 on the parent's functions.php but the screen went white when I log in. Right now I'm trying to fix that. Did I misunderstand your instructions?

  10. Brooke972
    Member
    Posted 3 months ago #

    The other problem that has come up since then is the posts whose images are in the featured image slider don't appear as posts on the recent posts homepage.

  11. Did I misunderstand your instructions?

    Yes. :-) I'm sorry I wasn't more clear.

    You should never alter the parent theme files.

    Revert the parent's functions.php back to the original, unedited version.

    I will post a link to the full code you'll need to add to your child theme's functions.php file in a moment.

  12. After reverting the parent theme's functions.php back to the original, here is what you do in more detail:

    1) in the child theme's functions.php, remove the earlier function I instructed you to add, namely:

    <?php
    if ( ! function_exists( 'untitled_setup' ) ) :
    
    function untitled_setup() {
    	add_image_size( 'slider-img', 1440, 700, true );
    }
    endif; // untitled_setup
    
    add_action( 'after_setup_theme', 'untitled_setup' );
    ?>

    2) In the child theme, copy over the function I've put in this pastebin:

    http://pastebin.com/Q04P100b (Edit: I made a correction in the Pastebin)

    This pastebin consists of the entire original function called untitled_setup, which I just copied out of the original parent theme. There is only one small change from the original function: on line 32 you'll see that the number 400 becomes 700, or whatever height you want.

    By pasting the entire function over in your child theme, you should get back the functions you were missing earlier.

    Let me know how it goes.

  13. Brooke972
    Member
    Posted 3 months ago #

    Perfect. Thank you so much. I'm marking this as resolved.

  14. Great, glad you're set.

  15. Brooke972
    Member
    Posted 3 months ago #

    Oh I forgot one other issue that arose while doing this. I made a commented above but it wasn't addressed.

    Since making these changes, the posts whose featured images are in the slider do not appear the home page recent posts, but only in the slider. For example "Preguntas de Facebook" should lie between "6 COSAS QUE TIENES QUE HACER MIENTRAS ESTÁS SOLTERA" and "UN PAPÁ ASOMBROSO" but it does not.

  16. Since making these changes, the posts whose featured images are in the slider do not appear the home page recent posts, but only in the slider.

    That's actually how the theme - and most themes with featured content - work. To avoid duplication, posts in the slider are not repeated in the main blog index a second time.

    It should actually have been like this even before making the functions.php changes. To test it, you can simply remove the functions.php file in your child theme and let the parent theme take over temporarily.

  17. Brooke972
    Member
    Posted 3 months ago #

    Hmm you are right. I do remember exactly though that there was both before making these changes. Is there a way to go back to having the post in the slider and below without undo the changes we already made?

  18. As you can see in this demo, the theme always excluded posts in the slider from the main blog index.

    In your child theme's functions.php file, adding this function should override that behaviour. Be sure to add it within the opening and closing PHP tags.

    function untitled_remove_pre_get_posts() {
    	remove_action( 'pre_get_posts', array( 'Featured_Content', 'pre_get_posts' ) );
    }
    add_action( 'init', 'untitled_remove_pre_get_posts', 31 );

    I just tested it in a child theme and it's working here. Let me know how it goes.

Reply

You must log in to post.

About this Theme

About this Topic