• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Suggestion: Allow PHP code in Theme Settings >Head Scripts

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Suggestion: Allow PHP code in Theme Settings >Head Scripts

This topic is: not resolved

Tagged: Head Scripts, PHP Code, theme settings

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 6 months ago by TrishaM.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • July 28, 2014 at 3:44 pm #116151
    TrishaM
    Member

    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 #116169
    Marc
    Participant

    Why not use Genesis Simple Hooks?

    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.


    Resultz Digital | Websites, search marketing services and consulting for small business.

    July 28, 2014 at 8:09 pm #116177
    TrishaM
    Member

    Thanks 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.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble