Community Forums › Forums › Archived Forums › General Discussion › Suggestion: Allow PHP code in Theme Settings >Head Scripts
Tagged: Head Scripts, PHP Code, theme settings
- This topic has 2 replies, 2 voices, and was last updated 10 years, 5 months ago by TrishaM.
-
AuthorPosts
-
July 28, 2014 at 3:44 pm #116151TrishaMMember
I realize there are other ways to add PHP code to a website's <head> area, but I prefer to do so in a way that will not (ever) be effected by updates to either Genesis or the Child Theme I'm using, and in a way that is easy (or at least easier than modifying either a Child Theme header.php or functions.php) for a non-programmer website admin to maintain.
Currently any PHP code placed in the Genesis Theme Settings >Head Scripts box gets commented out when the page is rendered.
Why not simply include another box specifically for PHP code? Include an "Advanced" checkbox that must be checked before it will display with a caveat that only someone who knows what they're doing should use it, but this would give a graceful, bullet-proof way to add PHP when it's needed.
Thanks for considering this suggestion. 🙂
July 28, 2014 at 6:52 pm #116169MarcParticipantWhy not use Genesis Simple Hooks?
This plugin creates a new Genesis settings page that allows you to insert code (HTML, Shortcodes, and PHP), and attach it to any of the 50+ action hooks throughout the Genesis Theme Framework, from StudioPress.
July 28, 2014 at 8:09 pm #116177TrishaMMemberThanks for the suggestion Marc - I'm aware of that Plugin but my preference is to keep things as simple as possible and that also means as Plugin-free as possible.
On this particular site I'm working on (sorry, on a development server only at the moment, not accessible to the outside world), our prime directive is that every line of code, and every plugin, has to earn it's way in. Lean and mean is the watchword. So I'll wind up using a hook, but without the plugin - I'll put it in the Child Theme functions.php
That said, I've already added quite a bit of stuff to the Child Theme's functions.php, but I would prefer a better way to handle that as well - if the Child Theme gets updated the functions.php will be overwritten. Sure I can perform regular backups of the Theme files, but that won't help the site owner who does a Theme update and wipes out half of the added functionality *until* we can get a restore done from backups.
Since Genesis *already has* a setting for injecting scripts into the head, why not allow for PHP to be injected also? And ideally, a way to call a secondary functions.php file (or somewhere that custom functions have been added) to protect against Child Theme updates that could overwrite custom functionality?
There are some amazingly well-designed Child Themes available, but since even minor modifications often mean adding stuff to the functions.php, it would be nice to have a way to add those mods in a update-proof way.
So it's just a suggestion - we'll take steps to protect ourselves, but adding this to Genesis would really make it a bullet-proof framework that would be even more useful than it already is.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.