Skip to content

mosne/mosne-hero

Repository files navigation

Mosne Hero

Hero

Description

This plugin extends the core/cover block with separate mobile and desktop background images and sizes. This increases the performance of the website by loading the smaller image on mobile devices and scores better in the Core Web Vitals.

Configuration

  • In the Settings > Mosne Hero page you can configure the mobile image size and the breakpoint at which the mobile image is displayed
  • Note that this is a new size, so you will need to regenerate the thumbnails using a plugin like Regenerate Thumbnails for existing images to use the new sizes.

In the Editor

  • Add a cover block and select the "Hero Cover (Mobile & Desktop)" variation.
  • Now you can see a new panel with the following options:
  • Mobile image : You can also select a custom image for the desktop and the mobile view.
  • Mobile image size : choose the size that perfectly fits your design.
  • Focal point : You can also select a focal point for the mobile image.
  • Alt text : Add alternative text for the mobile image. (Leave empty if it is a decorative image)
  • High fetch priority : force the high fetch priority attribute if the image is above the fold.
  • If you use a featured image, leave the mobile image empty and the plugin will use the mobile size for the featured image for the mobile view.

Key Features

  • Separate mobile and desktop background images and sizes
  • Configure the mobile image size and the breakpoint at which the mobile image is displayed
  • It also works with the featured image
  • Focal point switching for the mobile image
  • Alt text switching for the mobile image
  • High fetch priority for the mobile image
  • Performance-optimized and lightweight

Limitations

  • The mobile image is not displayed in the block editor
  • Video background is not supported
  • Repeated background is not supported
  • Parallax background is not supported

Stay Connected

Installation

  1. You have a couple of options:
  • Go to Plugins → Add New and search for "Hero". Once found, click "Install".
  • Download the Hero from wordpress.org and make sure the folder is zipped. Then upload via Plugins → Add New → Upload.
  1. Activate the plugin through the 'Plugins' screen in WordPress.
  2. Search for the "Hero" block within the Block Editor (Gutenberg) and add it to your page.

Frequently Asked Questions

How can I configure the plugin?

You can configure the plugin in the settings page.

What are the available hooks?

You can use the following hooks to configure the plugin:

add_filter( 'mosne_hero_enable_image_size', '__return_false' );
add_filter( 'mosne_hero_mobile_width', 'your_function' );
add_filter( 'mosne_hero_mobile_retina_width', 'your_function' );
add_filter( 'mosne_hero_mobile_height', 'your_function' );
add_filter( 'mosne_hero_mobile_retina_height', 'your_function' );
add_filter( 'mosne_hero_crop', 'your_function' );
add_filter( 'mosne_hero_breakpoint', 'your_function' );
add_filter( 'mosne_hero_settings', 'your_function' );
  • This will disable the image size registration.
  • This will return the mobile width and the mobile retina width.
  • This will return the mobile height and the mobile retina height.
  • This will return the crop option.

Screenshots

  1. Add a mobile image and a desktop image screenshot-1
  2. Setup options and labels screenshot-2
  3. Render the block screenshot-3
  4. Example of source code for the block screenshot-4

About

wordpress block cover with mobile and desktop image

Resources

Stars

Watchers

Forks

Packages

No packages published