Square Wheels Posted December 15, 2023 Posted December 15, 2023 Hi, Is there an add-on that lets you insert code in a specific location? For instance, in this case, I use a chat option that wants the code inserted before the </body> tag. It's a pain to update 6 different themes, then each time I update the theme, I need to remember to re-inset that code. Thanks
teraßyte Posted December 15, 2023 Posted December 15, 2023 I don't remember any such existing modification that does this, but it would be a quick one to write.
Square Wheels Posted December 16, 2023 Author Posted December 16, 2023 23 minutes ago, teraßyte said: I don't remember any such existing modification that does this, but it would be a quick one to write. Quick for whom? 🙂 It would take me many months to learn how. I can think of several options that would be helpful. At the beginning and end of head, and at the beginning and end of body. If you make it, please leave a link to your site so I can buy it. teraßyte 1
beats23 Posted December 16, 2023 Posted December 16, 2023 (edited) There was one on here called "Custom Head and Body". It's now gone with the closed marketplace. Edited December 16, 2023 by beats23
Solution Daniel F Posted December 16, 2023 Solution Posted December 16, 2023 There's no need for a 3rd party app! You can add custom HTML code to the end of the </body> tag by adding it to the footer HTML field. Safety1st and DawPi 2
Square Wheels Posted December 16, 2023 Author Posted December 16, 2023 4 hours ago, Daniel F said: There's no need for a 3rd party app! You can add custom HTML code to the end of the </body> tag by adding it to the footer HTML field. This sounds like a great solution. That would be maintained with theme updates, correct?
Jim M Posted December 16, 2023 Posted December 16, 2023 1 hour ago, Square Wheels said: This sounds like a great solution. That would be maintained with theme updates, correct? Yes, this is a part of the core solution so will be a part of unmodified theme updates from release to release.
Square Wheels Posted December 16, 2023 Author Posted December 16, 2023 Yay, this works. Sadly, I needed to disable my Snow plugin as it seems to have conflicted.
Square Wheels Posted February 8 Author Posted February 8 On 12/16/2023 at 8:56 AM, Jim M said: Yes, this is a part of the core solution so will be a part of unmodified theme updates from release to release. So I just updated my site to 4.7.15 and updated my themes, all from @Ehren. The default IPS theme was maintained, but the other themes had the code deleted. Is that expected? Thanks
Management Matt Posted February 9 Management Posted February 9 What was deleted? This was a standard upgrade that would not remove data from custom themes.
Square Wheels Posted February 9 Author Posted February 9 3 hours ago, Matt said: What was deleted? This was a standard upgrade that would not remove data from custom themes. In December, I added JS to Theme --> Custom theme by Ehren --> Header and Footer --> Footer HTML. Yesterday I updated the site to 4.7.15. Then, I updated 5 themes I have by Ehren. All five themes had the JS removed from the Footer HTML field.
Nathan Explosion Posted February 9 Posted February 9 40 minutes ago, Square Wheels said: In December, I added JS to Theme --> Custom theme by Ehren --> Header and Footer --> Footer HTML. Yesterday I updated the site to 4.7.15. Then, I updated 5 themes I have by Ehren. All five themes had the JS removed from the Footer HTML field. Reproduced as follows; Create a brand new theme Download the theme using the option in the console Edit the theme, populate the header and footer bits via the available tab. Review site on front-end, verify items are there. Use the "Upload a new version" option on the theme, and use the XML file that was downloaded in step 2 Edit the theme - the previously added header/footer content is gone Review site on front-end, the previously added header/footer content may still be there in the theme. If so... Run support tool to clear caches Review site on front-end, the previously added header/footer content are now gone. Square Wheels 1
Management Matt Posted February 9 Management Posted February 9 Hmm. I can see why the code does that. The XML does not have header/footer, so any changes to those areas look to be reset when you upload a "new" version which does not have any header/footer code so the theme represents what is in the XML. I guess what you're asking for is header/footer code to persist through upgrades? It may mean you get some conflicts you'll need to manually manage.
Square Wheels Posted February 9 Author Posted February 9 6 minutes ago, Matt said: I guess what you're asking for is header/footer code to persist through upgrades? It may mean you get some conflicts you'll need to manually manage. Yes, that would be preferred. I purchase the branding-free option. I previously made a CSS edit. I get asked each time if I want to keep the new or the old template. This would be the same. For now, I'll remember to add the code back. I use it for a help bot.
Recommended Posts