This feature can now be enabled without writing any code, using an admin UI, with the Timeline Express – Toolbox Add-On.

Out of the box, Timeline Express defines it’s own image size to use in the Timeline. The custom image name is ‘timeline-express’ and the size of the thumbnail is 350px x 120px. If you want to use a larger image size, you can use the provided filter to use a different thumbnail size.

The following code should be added to the bottom of your active themes functions.php file, and will use the ‘full’ image size on both the timeline and on the single announcement template.


function custom_timeline_express_announcement_image_size( $image_size, $post_id ) {
    $image_size = 'full';
    return $image_size;
}
add_filter( 'timeline-express-announcement-img-size' , 'custom_timeline_express_announcement_image_size', 10, 2 );

Only on Announcement Pages

If you only wanted to alter the image size on the single announcement template, you can add a is_single() check to the code. The following code will adjust the image size on the single announcement pages, to use the ‘full’ image size.


function custom_timeline_express_announcement_image_size( $image_size, $post_id ) {
    if( is_single() ) {
       return 'full';
    }
    return $image_size;
}
add_filter( 'timeline-express-announcement-img-size' , 'custom_timeline_express_announcement_image_size', 10, 2 );

5 Comments

  1. Hi there,

    Is it possible to have the image show above the announcement title in the timeline? Is this something that can be coded or something that can be changed with an add-on?

    Thanks!

    Reply
    • Hi Brad,

      You can certainly shift things around and make the timeline container look however you would like. However, this is not something that is built into the plugin, and would require a bit of custom code. You can either customize the announcement template, to shift around the markup so the image displayed above the timeline title, or you can use PHP and remove the action from its current location and re-hook it into the location before the title.

      Feel free to take a look at the documentation found here https://www.wp-timelineexpress.com/documentation/customize-announcement-container/

      Evan

      Reply
  2. Hi I’m wondering why some images are automatically generating thumbnails, while others are showing full images? I have not added any additional code and am using the free version of Timeline Express. Thanks.

    Reply
  3. For those who want to display thumbnail size image in their timeline, please follow this code :

    custom_timeline_express_announcement_image_size( $image_size, $post_id ) {
    $image_size = ‘thumbnail’;
    return $image_size;
    }
    add_filter( ‘timeline-express-announcement-img-size’ , ‘custom_timeline_express_announcement_image_size’, 10, 2 );

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.