Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #92921
    Leonardo Martinez
    Participant

    Hi!

    I’m trying to change the thmbnail’s size.

    http://narguilebr.com.br/

    screenshot

    As you can see, they have a square aspect 1×1 and I’d like to make it a Wide aspect 16×9, but I don’t know how to do it.

    #92952
    Mahesh
    Participant

    @leonardo-martinez: Changing thumbnail will change size for all post’s thumbnail. For changing thumbnail, you’ll need to create a child theme first. You can find more details on creating child them HERE. Then in your child theme’s functions.php add the following codes:

    add_action( 'init', 'catchresponsive_child_custom_thumbnail_size' );
    function catchresponsive_child_custom_thumbnail_size() {
    	remove_image_size( 'catchresponsive-square', 200, 200, true ); // used in Archive Left/Right Ratio 1:1
    	add_image_size( 'catchresponsive-square', width, height, true ); // used in Archive Left/Right Ratio 16:9
    }

    Note: In the above code, Please change the X and Y to your desired Width and Height in px for 16:9 appect ratio
    Then after that use Regenerate Thumbnails to regenerate the thumbnails for existing images.
    https://wordpress.org/plugins/regenerate-thumbnails/
    Let me know if any problem.

    Regards,
    Mahesh

    #93123
    Leonardo Martinez
    Participant

    Hello Mahesh, I created the Child Theme and then in its functions.php I pasted the code and changed the Width and Height as you told me, just like bellow.

    <?php
    //
    // Recommended way to include parent theme styles.
    //  (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
    //  
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array('parent-style')
        );
    }
    //
    // Your code goes below
    //
    add_action( 'init', 'catchresponsive_child_custom_thumbnail_size' );
    function catchresponsive_child_custom_thumbnail_size() {
    	remove_image_size( 'catchresponsive-square', 200, 200, true ); // used in Archive Left/Right Ratio 1:1
    	add_image_size( 'catchresponsive-square', 325, 200, true ); // used in Archive Left/Right Ratio 16:9

    The result is:

    Parse error: syntax error, unexpected $end in /home/sosna518/public_html/narguilebr.com.br/wp-content/themes/child-themere/functions.php on line 20

    What did I do wrong? I didn’t even use the Regenerate Thumbnails.

    #93156
    Mahesh
    Participant

    @leonardo-martinez: You missed the trailing/closing curly brace (}) at the end. Please add it and it’ll resolve the issue.
    Let me know if any problem.

    Regards,
    Mahesh

    #93224
    Leonardo Martinez
    Participant

    Mahesh, I did what you told me but it didn’t go right. It fixed the syntax error but it broke my site’s layout, just like the image.

    new screenshot

    Any suggest?

    #93231
    Mahesh
    Participant

    @leonardo-martinez: Was your child theme working fine before? Please remove the code I’ve provided you above from the child theme and test if the layout is working fine.
    The function is working fine as I test in our server.
    Let me know further.

    Regards,
    Mahesh

    #93267
    Leonardo Martinez
    Participant

    @mahesh: Yes, it was working before the change, I removed the code you provided and it worked as before.

    Any idea?

    I don’t know what is wrong, because it should be working as you tested it.

    #93284
    Mahesh
    Participant

    @leonardo-martinez: For testing, I copied the code to functions.php with a trailing brace and it worked fine on our server.
    It should have worked fine. You can download the theme file from the link below:
    https://www.dropbox.com/s/dyzcmcrlhuv9jbu/catch-responsive-child.zip?dl=0
    Let me know if any problem.

    Regards,
    Mahesh

    #93801
    Leonardo Martinez
    Participant

    @Mahesh: I inserted the code you gave me in the .rar and it didn’t brake the layout this time, but it has no effect. It keeps the same size of the thumbnails.

    new screenshot

    #93833
    Mahesh
    Participant

    @leonardo-martinez: Have you used the Regenerate Thumbnails plugins to regenerate new sized thumbnails? You have to run it once you’ve changed the image size.
    Find the plugin in the link below.
    https://wordpress.org/plugins/regenerate-thumbnails/

    Let me know if any problem.

    Regards,
    Mahesh

    #93875
    Leonardo Martinez
    Participant

    @Mahesh: I forgot this step.

    I did it now and it worked perfectly!

    Thank you!

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘How to change first page thubnail's size’ is closed to new replies.