• Hi there,

    I am new to WP. I inherited of the maintenance of a WP website.

    The site owner would like to change the theme. Problem is: there are custom modifications in some php pages in the current theme. I tried to copy them in the new theme folder, but it’s not styled.

    How do we achieve this? Having custom pages/blocks that would not be affected by a change of theme?

    It is against my understanding of what a theme is that changing a theme would cause BCB and information loss.

    Thank you in advance!

    PS: as I am a web dev, I could – at least I presume – easily hack WP to include code below the “themes” folder (i.e. not lost when changing a theme), but I’d like to do it “the WP way”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The WP way is to add custom page templates. Then log in to wp-admin and open the page in question. Then on the right hand side, there will be a template drop-down that will let you select the custom template.

    To make a new template page that WordPress will recognize, the main thing is to make the top comment block with the right formatting.

    Assuming you do that, the rest can be all the custom code you want. Often a good starting point for small mode is to copy and paste the page.php code.

    Doc:
    https://developer.www.ads-software.com/themes/template-files-section/page-template-files/

    If you change the theme you can move the custom PHP pages to the new theme and give them a body class. Make sure to also copy over all custom CSS and add the body class so it does not affect the new theme’s pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use new themes when you have custom pages’ is closed to new replies.