[Resolved] Srcset in Page Headers

Home Forums Support [Resolved] Srcset in Page Headers

Home Forums Support Srcset in Page Headers

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #562806
    AMBTL

    Hi Guys,

    Since srcset is generally a good thing, I suppose it would be a good idea to use it in page headers, especially because some wide images can be relatively heavy.

    Unless I am missing something, it doesn’t work automatically in GP.
    I have to use “Content” in Page Headers to merge them with navigation. And I don’t want to use backgrounds, because I want to preserve the aspect ratio.

    When I add <img src="/image-url" />, srcset is not generated (I kind of expected that :).

    So, I came up with a workaround, but I’d say it’s not ideal and perhaps there is a better way. Here is what I did:

    – create a dummy post, click on “ADD MEDIA” button and select the image in full-size
    – save the post with the image and view it
    – copy the img html using Inspector. It will include all srcset code and image urls
    – paste it into the page header and adjust the width, otherwise it may not take the full-width of the screen

    Simply copying the source text from the post edit screen won’t work, it won’t generate srcset.

    Now, if we could have an Add Media button in Page Headers’ content tab, perhaps it would generate the srcset code automatically without any workarounds?

    Or perhaps I am missing something and there is a better way?

    One problem with this manual method may be modifying the image sizes at some point in the future and regenerating thumbnails (standard WordPress sizes and custom added sizes). Then the manually inserted URLs won’t work anymore.

    Cheers
    Tom

    #562877
    Tom
    Lead Developer
    Lead Developer

    Hey Tom,

    The Page Header content tab doesn’t use TinyMCE or the WP content filters, which is why srcset isn’t generated automatically.

    While we could add the WP content filters to the content, it would likely cause more issues than it would solve.

    While your method isn’t ideal, it’s probably the best way to go about it right now.

    I’ll look into adding a similar Add Media button to Page Headers to make this easier.

    Thanks!

    #562882
    AMBTL

    OK, thanks Tom. Yeah, some kind of a media button would be very convenient, even regardless of the srcset thing.
    Cheers

    #563186
    Tom
    Lead Developer
    Lead Developer

    I agree. Thanks for the suggestion! 🙂

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