Custom HTML/Components

We have a pretty large grid on one of the pages with zoom-boxes.
The boxes always load imgages in a high resolution, eventhough less than half of it is needed at least in 3 of 4 display breakpoints.
Furtheron the grid is not working with lazy loading of wp-rocket.
There seems be no way to make the images use a srcsets.
So finally I'd like to replace zoomboxes with custom HTML, which is a pain in the ass due to the editor settings which rewoves/replaces elements - not sure if that's some kind of restriction of inline editing in general or based on the settings.
In addition the grid seems to do some respositioning by JS making it even harder to get things done.
Our customer wants to keep the gridded layout, so we need something using srcsets. Probably the best way would be adding custom HTML, because IMO there's missing one image size around 400 px to make the sourceset eficient. We already added that.
Is there any way to control the visual editor or add a custom component for grid-boxes?
In addition can we do anything to get lazyload to work with the grid?

Thanks in advance

Comments

  • Hi,
    Unfortunately, the only way to add sourceset for certain images which does not have this feature require theme files customization, which we do not support.

    But, to help you, I provide you the path and name of the file which is responsible of that behavior.
    It's in the functions folder, the file's name is theme-shortcodes.php

    Thanks
  • Thanks for responding.
    I already knew that path, not sure if it is the best idea to change the code - i'd prefer using custom markup and keep the intended behaviour for future content.
    Anyways, in case I will end up there, do you have another hint how to get the id for the image?
    It's not passed by the function params but would be needed to calculate the srcset.

    Thanks in advance.
  • You could get the id using a js script which will take the src of that image and it will replace it with sourceset, but I'm not sure if thats gonna work.
    It's just a spontaneity idea.

    We suggest, to try to catch it somehow with the php and customizing the theme files - it will be the best way.
    Remember to use the Child Theme to prevent loss of modifications while updating the theme.
    Thanks
  • Thanks again for replying.
    JS is probably not the way, especially when working in data that aleady exists.
    I'll go the child theme way then - was trying to avoid that cause I don't have an overview of the way things are done in there and it seems there's pretty many things included in the build process.
    I'll get back with more questions when I got stuck.
    Thnks so far!
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.