WordPress.org

Ready to get started?Download WordPress

Forums

Testimonials by Aihrus
[resolved] [Plugin: Testimonials Widget] testimonials_widget_image_size not working in functions.php (6 posts)

  1. cliffordhill
    Member
    Posted 1 year ago #

    I'm wondering if I'm wrong in adding the image size filter to my theme's functions.php file to config featured image size display. Is there another place to add the filter and, if so, where and what is the syntax exactly for a 575w x 350h image?

    When I enter the filter in the functions.php file, the full size image displays only. I've tried both the width,height array method as well as medium, large etc. instead of the array. It always shows the full size image regardless.

    Example in STUDENT VOICES section near bottom here: http://gse.zdca.biz

    The large image that exceeds the layout seems to also remove the testimonial text entirely too. If I comment out the filter in the functions.php file, everything works except the image is the thumbnail size (which I don't want).

    What I've tried in the functions.php that both produce the same broken result:

    add_filter( 'testimonials_widget_image_size', array( 575, 350 ) );

    add_filter( 'testimonials_widget_image_size', medium );

    Any help is much appreciated, thanks!

    http://wordpress.org/extend/plugins/testimonials-widget/

  2. cliffordhill
    Member
    Posted 1 year ago #

    Shoot! I just noticed that the page I want to use for the list of all testimonials is also showing these full size images.

    http://gse.zdca.biz/about-us/student-testimonials/

    I need these to be thumbnail size and right-aligned, not pulling a single global size from a filter.

    Seems like this plugin would benefit from having widget and shortcode settings for size. Anyone who wants to have testimonials appear in multiple places with different layouts such as sidebar, full page, and others like a homepage callout block would need flexibility on image size (like me :-).

    Also, this begs the issue of custom URLs. A homepage callout or even a sidebar slider is a good place to link to a page that shows a list of all testimonials entered. Would love to see a field in the widget and in the shortcode of adding a custom link URL.

  3. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    For the image size, I just realized that the documentation is wrong and have corrected it for a future release.

    In the meantime, try the following code to only adjust testimonial image sizes for the home page.

    if ( is_home() ) {
    add_filter( 'testimonials_widget_image_size', 'my_testimonials_widget_image_size' );
    
    function my_testimonials_widget_image_size( $size ) {
        $size                       = array( 575, 350 );
    
        return $size;
    }
    }

    For exception pages like your http://gse.zdca.biz/some/other-page/, use the is_page() function to determine if you need a special sizing for that page.

  4. cliffordhill
    Member
    Posted 1 year ago #

    I cannot get it to work unfortunately. I updated the plugin to v2.1.4 and removed the old filter from the functions.php file and replaced with your example above. I'm using WP 3.4.2.

    I tried is_home() and is_page('home') and is_page(2) (for the post ID of the page being used on the home), plus tried is_page('student-testimonials') and is_page(598) (post ID for the Student Testimonials page) to test larger images on the list page all without success.

    The image sizes remain at the thumbnail size regardless. Am I missing something or...? Thanks again for any help.

  5. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    Have you tried the add_filter() and my_testimonials_widget_image_size() without any if case?

  6. Michael Cannon
    Member
    Plugin Author

    Posted 1 year ago #

    Any luck getting the sizes and conditions the way you need them?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic