Limit the banner Size

Limit the banner Size

An event banner in WP Event Manager plays a pivotal role in attracting your target audience toward your event. It displays your event details and catches the attention of your audience with its exclusive designs and images.

However, to ensure that your website runs smoothly, you need to instruct the event organizers about the banner size as well. This is because too big banner images can affect your website speed. A maximum of 2MB image file can be accepted from everyone.

So how to limit the banner image size? You will learn about the steps in this guide.

Here are the steps that you need to take to limit the event banner size:

  1. Open your child theme function.php.
  2. Add the following code:
  1. add_filter('event_manager_upload_file_pre_upload', 'wpem_event_manager_upload_file_pre_upload', 10, 3);
  2.    function wpem_event_manager_upload_file_pre_upload($file, $args, $allowed_mime_types)
  3.     { 
  4.        if(!empty($file))
  5.         {
  6.             if(isset($file['size']) && $file['size'] > 400000 )
  7.             {
  8.                 return new WP_Error( 'validation-error', __( 'Event banner size no more than 400kb.', 'wp-event-manager' ) );
  9.             }
  10.         }        
  11. return $file;
  12.     }
    • Related Articles

    • How to replace default event banner placeholder image

      Replace default event banner placeholder image In order to add the default image in the banner, when someone does not submit any event banner, you can add the following code Open your child theme, Add the code into the funtions.php file: add_filter( ...
    • Create or pick categories from Free/ Core WP Event manager

      Events are classified into various types based on the kind of visitors they have. Visitors come from different backgrounds. That is why an event organizer or admin must ensure that they make a lot of event categories available to their clients. This ...
    • Create or pick categories from Free/ Core WP Event manager

      Events are classified into various types based on the kind of visitors they have. Visitors come from different backgrounds. That is why an event organizer or admin must ensure that they make a lot of event categories available to their clients. This ...
    • Updating WP Event Manager

      Automatic Update WP Event Manager always strives to achieve perfection in every way and that is why we constantly update our plugins so that you can enjoy their innovative features. Here are the steps that you need to take to update WP Event Manager: ...
    • Installation of WP Event Manager

      Automatic Installation of FREE WP Event Manager Installing WP Event Manager is just a matter of a few clicks. You can add WP Event Manager to your website by using the dashboard offered to you at the backend of the CMS. To install the plugin ...