Change a classic theme's PHP templates in a draft child theme
Make a change that needs PHP, such as a note under the Add to cart button, in a draft child theme that is checked and previewed before it goes live.
- Difficulty
- Advanced
- Time
- about 40 min
My site uses a classic theme. On [where, e.g. every product page, under the Add to cart button] I want [change, e.g. a short line: 'Orders before 14:00 ship the same day']. Do it in a draft child theme, never in the live theme. Read the parent theme's files first so you override as little as possible. Check the draft before you show me anything, send me the preview link, and tell me how publishing works on my site. Publish only when I say so.
Already connected?
If SAR is already in your AI app, this is enough:
Add [change] to [where] in a draft child theme, check it, and send me the preview.
What happens
- The AI app starts a draft child theme next to the live one; the live theme is never edited.
- It reads the parent theme's files to find the right place and overrides only what is needed.
- It writes the PHP file; each one is checked, and code execution, file or option writes and remote calls are refused.
- It checks every PHP file it wrote and tries the draft on the site's main kinds of page, then gives you a preview link that works for an hour.
- Publishing is approved in SAR with your password; SAR tries the main pages first and switches back by itself if a fatal error appears in the next ten minutes. On a site installed from WordPress.org a person publishes it in wp-admin.
Approvals involved
Worked out from the tools this recipe uses.
wordpress_create_draft_themeStart a draft themeNonewordpress_read_theme_fileRead a theme fileNonewordpress_write_theme_fileWrite a theme fileNonewordpress_check_draft_themeCheck the draft theme before publishingNonewordpress_get_theme_previewPreview the draft themeNonewordpress_publish_draft_themePublish the draft themeApproval and password
What you get
The change you wanted, made without touching the live theme's code, and easy to undo.
Related recipes
- Design & builders · about 30 minRedesign your site in a draft child themeTry new colours, fonts, a header and a footer in a draft theme next to the live one, check it through a preview link, and publish only with your password.
- Design & builders · about 10 minChange the words on an Elementor, Bricks or Divi pageRewrite headings, paragraphs and buttons on a page-builder page without opening the builder. The layout stays as it is, and a live page waits for your approval.
- Design & builders · about 25 minBuild an Elementor landing page as a draftDescribe the page you need and get a full Elementor layout in a draft page, with a preview link, before anything goes live.
Try it on your own site
Install the plugin, add SAR to your AI app and paste the prompt. Free to start.