WordPress.org

Ready to get started?Download WordPress

Forums

Feature A Page Widget
Feature Request: Set max-width and max-height (4 posts)

  1. umchal
    Member
    Posted 2 years ago #

    When I choose "Wrapped Image", currently the width and height for the featured image seem to be set 200px. I'd like to make the size a little bit larger.

    What about an input field in the widget box that allows the user to set the maximum width and height? If it is not technically difficult, I wish it is implemented.

    http://wordpress.org/extend/plugins/feature-a-page-widget/

  2. MRWweb
    Member
    Plugin Author

    Posted 2 years ago #

    Check out this thread and see if that solution works for your. Note the difference between the image size and the CSS layout size mentioned in the last post.

  3. umchal
    Member
    Posted 2 years ago #

    Yes, to make it 300px x 300px, the following code works. Thanks.

    // create custom image size, 80x80 with hard crop
    add_image_size( 'fpw_custom_thumbnail', 300, 300, true);
    
    // override the featured image with custom size image
    function fpw_custom_featured_image( $featured_image, $featured_page_id ) {
        return get_the_post_thumbnail( $featured_page_id, 'fpw_custom_thumbnail' );
    }
    add_filter( 'fpw_featured_image', 'fpw_custom_featured_image', 10, 2 );

    Adding the style rule seemed not necessary when the image is set to a larger scale by the way.

    Also changing the values in the following line in feature-a-page-widget.php worked. But this edits the plugin code so it's not recommended since it will be gone after an plugin update.
    add_image_size( 'fpw_square', 200, 200, true );

    Currently setting a custom width and height requires a little bit complicated coding for end users so maybe it's an good option to consider implemented as an option.

  4. MRWweb
    Member
    Plugin Author

    Posted 2 years ago #

    Because the image-width is a percentage, whether the image is large-enough to occupy the full space (or is shrunk down) will change from site-to-site. I'll try to think through how I can let people control the images better in future versions. Thanks for the feedback!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.