Resize featured image


Hi, i need to resize the featured image, i add it on top of the posts on blog page so I did that

if(is_home()){
    //featured image on top of posts on blog page
    apply_filters( 'beans_edit_post_image_args', array(
      'resize' => array( 800, 400, true ),
    ) );
    add_action( 'beans_post_prepend_markup', 'beans_post_image' );

  }

But it doesn't work



It doesn't works for me the solution proposed by the other guy works

add_filter( 'beans_post_image_edit', '__return_false' ) ;
set_post_thumbnail_size( 800, 400, true );

But it doesn't hard crop the image, it keeps the proportions, so i get an image of 400 x 400 as the original image is squared Which is not what i want


I am not a developer, so I experiment and sometimes I don't understand very well why it works or not. In my home.php I added this code:

add_filter( 'beans_edit_post_image_args', 'myprefix_post_image_edit_args' );
function myprefix_post_image_edit_args( $args ) {
    return array_merge( $args, array(
        'resize' => array( 300, 180, true ),
    ) );
    }

and in functions.php I added this:

// Move the post image above the post title.
beans_modify_action_hook( 'beans_post_image', 'beans_post_title_before_markup' );

add_filter( 'the_content', 'beans_child_modify_post_content' );

function beans_child_modify_post_content( $content ) {

because I want the post images to be on top of posts in archives, too. I don't know if they are connected and it works for this reason. My blog is this: http://cucitoemodelli.altervista.org/ I made it myself, and I don't really know if it is ok with code.

Write a reply

Login or register to write a reply, it's free!