Support » Plugin: Sermon Manager » Sermon Image resizing on individual pages

  • Hi,

    Is there a way to add code that will force all individual sermon images to be displayed at a certain size? That is, whatever image an editor adds to the sermon, it would then be resized/displayed to a common size automatically (e.g. max 600px wide or high).

    Thanks
    Emma

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Those image sizes are based on your theme and not the plugin. You will need to create a custom single-wpfc_sermon.php and add that to your child’s theme.

    Hi Mike,

    I’m a newbie at this kind of customization. What would go into the single-wpfc_sermon.php file? And does it need to be referenced in any other files, e.g. functions.php?

    Thanks
    Emma

    This is a general idea on how to create a custom single-wpfc_sermon.php file: https://wpforchurch.com/my/knowledgebase/69/Modifying-the-Excerpt-of-a-Sermon-Archive.html

    Once you’ve found the single-wpfc_sermon.php, you need to find this: <img class="wpfc-sermon-single-image-img" alt="<?php the_title(); ?>" src="<?php echo get_sermon_image_url(); ?>"> and replace it with this: <?php render_sermon_image( 'medium' ); ?>. Then you need to change the image size to suit. Reference this: https://wpforchurch.com/my/knowledgebase/74/Images-for-Preachers-Sermon-Series-and-Topics.html

    And no, no need to add anything to your functions.php unless you are creating a custom image size.

    • This reply was modified 4 months, 2 weeks ago by Mike Matenkosky. Reason: typo

    Sorry, I should had said you need to edit your single-sermon-content.php, not single-wpfc_sermon.php.

    Hi Mike,

    Thanks, that’s been really helpful.

    I’ve managed to adjust the size of the image as you suggested by replacing:

    <img class="wpfc-sermon-single-image-img" alt="<?php the_title(); ?>" src="<?php echo get_sermon_image_url(); ?>">

    with: <?php render_sermon_image( 'medium' ); ?>.

    However, when I do this it then means that if there is no sermon image set on the individual page, the default sermon image is not displayed – there is just no image displayed at all. Is there a way to add that back in?

    Thanks
    Emma

    • This reply was modified 4 months, 2 weeks ago by emmalboyd. Reason: fixed code

    What size are you uploading your sermon images? Looks like your theme’s images allow 714px x 714px max, but your’re only uploading 300px x 302px. If you upload larger images and remove the code from above, you should be fine, unless I’m not understanding your question.

    Hi Mike,

    Sorry – I switched to working on this on a dev site for testing, rather than the live site. I’m working on the code on this page: https://ebdev.uk/qpbc/archivesermons/face-to-face-2/

    I’ve been able to redner the image as alternate sizes using <?php render_sermon_image( 'medium' ); ?>, however if there is no individual sermon image uploaded, it does not then load the default sermon image, which should appear on this page, as an example: https://ebdev.uk/qpbc/archivesermons/aroma/.

    I’m also interested in how to centre the image, if possible?

    Really appreciate your help, thank you!
    Emma

    You haven’t answered my questions.

    For your question on how to center the image, this should work:
    .wpfc-sermon-single-image {text-align: center;}

    While playing around in our test site I was trying to figure out how to increase the sermon size when we have a series image and no featured image. If you go back to your single-sermon-content.php and when it says:
    <img class="wpfc-sermon-single-image-img" alt="<?php the_title(); ?>" src="<?php echo get_sermon_image_url(); ?>">

    Add the image size:
    <img class="wpfc-sermon-single-image-img" alt="<?php the_title(); ?>" src="<?php echo get_sermon_image_url( '', 'medium', '', '' ); ?>">

    This is found in includes/sm-core-functions.php. The defaults: get_sermon_image_url( $fallback, $image_size, $series_image_primary, $post ).

    Hope this helps.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.