Developer guide
Developer guide
How to change and extend a PremiumPress theme in code, without losing your work when the theme updates.
Before you write code
Most changes need no code at all. Colours, fonts, the logo, homepage designs, the Site Generator, Elementor pages, custom fields, emails and every admin setting are stored in the database, and theme updates never touch them. Small CSS changes can go in Appearance ▸ Customize ▸ Additional CSS.
Write code when you need behaviour the settings do not offer. When you do, keep it in a child theme or your own plugin, never in the theme folder: the next update replaces every file in it.
The guide
- Child theme: set one up the right way, with the two lines PremiumPress needs.
- Page layouts: why copying a template into a child theme does not work, and what to do instead.
- Hooks and filters: the actions and filters the theme offers for your code, by area.
- Adding your own features: extra listing-editor cards, listing-page sections, member-area tabs, homepage blocks, emails and SMS.
- Writing a payment gateway: connect a payment provider the theme does not ship with.
APIs
MCP server (AI agents). Lets an AI agent such as Claude manage the site through a set of tools: listings, members, pages, designs and orders. It is off until an administrator turns it on and creates a key. See AI Assistant & MCP.
Mobile app API. The routes under /wp-json/ppt/v1/app/ serve the PremiumPress companion app. They are off by default (Settings ▸ Mobile app) and are built for that app, not as a general-purpose API. To work with site data from your own code, use WordPress functions and the hooks in this guide.
Settings for wp-config.php
A few constants can be set in wp-config.php, above the line that says "That's all, stop editing":
| Constant | What it does |
|---|---|
PPT_RECAPTCHA_OFF | true turns reCAPTCHA off. Use it if a misconfigured key has locked you out of the login page. |
PPT_2FA_OFF | true turns two-factor sign-in off, for when an administrator has lost their device. Remove it once you are back in. |
PPT_SMTP_PASS | Your outgoing mail (SMTP) password. It is used instead of the one saved in the admin, so the password can live in the config file rather than the database. |
PPT_GOOGLE_FONTS_CDN | true loads Google Fonts from Google instead of from your own server. |
PPT_ANTHROPIC_KEY, PPT_ANTHROPIC_MODEL | The key and model the AI Site Generator uses for text. |
PPT_OPENAI_KEY, PPT_OPENAI_MODEL | The OpenAI key and model the AI features use, including image generation. |
PPT_VERSION | The theme version used to refresh cached CSS and JavaScript. Set it in a child theme (see Child theme). |