简体   繁体   中英

How to resize image excerpt without cropping it in wordpress?

Basically I've helped someone set up his website a bit with a theme he bought on themeforest. What he wants now is a little over my head though. On this page:

http://www.richardpennington.com/blog/

The images are shown in a smaller (cropped) version with an excerpt of the text, the code I can find looks like this:

if ( !function_exists( 'writer_ancora_template_excerpt_theme_setup' ) ) {
    add_action( 'writer_ancora_action_before_init_theme', 'writer_ancora_template_excerpt_theme_setup', 1 );
    function writer_ancora_template_excerpt_theme_setup() {
        writer_ancora_add_template(array(
            'layout' => 'excerpt',
            'mode'   => 'blog',
            'need_terms' => true,
            'title'  => esc_html__('Excerpt', 'writer-ancora'),
            'thumb_title'  => esc_html__('Large  image (crop)', 'writer-ancora'),
            'w'      => 300,
      'h'    => 500
        ));
    }
}

I"ve upped the values on 'w' and 'h' a bit because he wants the images to be shown fully but he wants them to be smaller without them being cropped and I honestly have no clue at all on how to do so. Also not sure how to edit the theme function. The thene's support can't help me either.

The problem is that he posts both landscape and portrait photos making a cropped setting quite weird. Thanks if you can help me.

well of course you can write your own code but that need some experience background on how to manipulate pictures using PHP but if you are looking for ready to use solution you can simply download this plugin :

Square Thumbnails

https://wordpress.org/plugins/square-thumbnails/

Note: am not related to author of this plugin in anyway just i found this plugin very helpful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM