Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1272713

    Feature request (unless this is already possible)
    Is it possible to add a box to the Enfold control panel that will allow me to add code to the header without modifying the header.php file?

    Basically another box similar to the Google Analytics tag box already in the Enfold Control Panel? But for anything else?

    This would allow me to easily add a prefetch or preload for any custom fonts used without installing another plugin or modifying the header.php file directly.

    I could also pre-load anything else that is causing problems with lighthouse and pagespeed testing.

    If it is not possible I will do it via the child theme.

    Thanks in advance.

    #1273289

    Hey Thomas,

    Thank you for the inquiry.

    You should be able to use the avf_option_page_data_init filter to adjust the existing fields or settings in the theme options or add a custom option. Usage examples of the filter can be found in the following threads.

    // https://kriesi.at/support/topic/add-a-custom-theme-options-tab/#post-1013077
    // https://kriesi.at/support/topic/child-theme-solution-for-change-an-avia_element/#post-1018770
    // https://kriesi.at/support/topic/alt-for-transparent-header-image/page/2/#post-1193253
    // https://kriesi.at/support/topic/child-theme-solution-for-change-an-avia_element/#post-1018190

    Another solution is to use hooks such wp_head or wp_footer.

    Best regards,
    Ismael

    #1273299

    Hi Ismael,

    Thank you for sharing the links.

    Little bit of an oversight my end I guess as it can be done using the default hooks.
    I will probably add something like this to functions.php
    https://www.webroomtech.com/add-code-to-header-and-footer-wordpress/

    Really useful document to understand what I want to do
    https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content

    This will allow me to add pre-load to fonts removing the error in Google Lighthouse testing without another plugin.

    I only have one more issue to deal with and that is serving Google Analytics or Tag manager locally. This may have to be a plugin solution for simplicity.

    Feature request: add pre-load to fonts option in performance panel
    Please can you consider adding this as an option to turn on in the performance panel?

    Google requests that render blocking resources like this are pre-loaded to prevent CLS caused by font swapping and ensure that custom fonts like icon fonts are visible immediately.

    Essentially select the toggle for pre-load and the preload tag is added to google fonts, fontello and any user uploaded fonts in the header of the page.

    It would be nice to have this as an option in the performance panel in Enfold, otherwise – Another plugin is needed which seems unnecessary. Enfold offers a range of built in fonts so the theme is a better place to deal with the issue.

    • This reply was modified 3 years, 10 months ago by thinkjarvis.
    #1273751

    Hi,

    Thanks for clarification. I have forwarded your request to our devs and shared this thread as reference :)

    Best regards,
    Yigit

    #1273762

    Thanks Yigit.

    #1273769

    Hi,

    You are welcome! If you have any other questions or issues, please let us know and keep up the good work! :)

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Insert code into header from within enfold?’ is closed to new replies.