Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Custom WordPress pages

I am developing a custom addon to a WordPress site.

I am using a technique I have used before on other projects where it works perfectly.

I use page.php in the theme folder to create customized pages in the site,

For example, a customer login page.

I create an empty WordPress page in WordPress and call it User Login.

Then I clone from page.php, building a php file called user-login.php. I put these custom php files into the theme folder on the web srver. That is, wp-content/themes/<theme name>.

All that works perfectly.

Yesterday, the Theme was updated (by some mechanism that auto updates the theme) when updates are available. That update (seemingly) deleted ALL the files in the theme folder called page-xyz-abc.php.

Is there a way to prevent that from happening?

Can the custom php files be put somewhere else and WordPress be pointed to that folder for custom pages?

The theme being used is Enfold, the host is WPEngine.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard Korts

ASKER

Jason,

Thanks for your insight.

Can you refer me to how one develops child themes?

If I do a child theme, can it be used JUST for the custom pages or does it have to be used for the entire site?

Thanks
https://codex.wordpress.org/Child_Themes

Most child themes are simply a CSS file in a new theme folder with special commenting at the top and one function in an otherwise blank functions.php to pull in the parent CSS.  This gives you a carbon-copy of the parent theme.  From there, WordPress will:

1. Give priority to the child theme for templates and CSS declarations
2. Execute both copies of functions.php from the child, then the parent theme

So in your case you would create a child theme from Enfold according to the codex and/or theme developer instructions and then create your custom page templates in the child as well as any CSS customizations in the child's styles.css and any custom functions in the child's functions.php and leave the parent templates, styles.css, and functions.php alone.  

The parent provides the basic structure, functions, and CSS and if it updates to a new version, your customizations won't break as severely, if it all.