-
AuthorPosts
-
January 15, 2021 at 1:47 pm #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.
January 18, 2021 at 11:07 am #1273289Hey 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-1018190Another solution is to use hooks such wp_head or wp_footer.
Best regards,
IsmaelJanuary 18, 2021 at 11:30 am #1273299Hi 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_contentThis 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.
January 19, 2021 at 3:52 pm #1273751Hi,
Thanks for clarification. I have forwarded your request to our devs and shared this thread as reference :)
Best regards,
YigitJanuary 19, 2021 at 3:59 pm #1273762Thanks Yigit.
January 19, 2021 at 4:06 pm #1273769 -
AuthorPosts
- The topic ‘Insert code into header from within enfold?’ is closed to new replies.