Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How to change a Wordpress theme smoothly

Hi! I run a website on Wordpress and use a theme bought from themeforest, but i want to change it to another preserving all the data. Fast and nice. How can i do this?

3 Answers

It depends on the new theme that you want to move to, things like your posts, pages, media will remain the same as they are core to WordPress but if the current theme contains custom fields and posts then these would be displayed using code in the front pages. For example if for every page your current theme allows you to enter a Page Description for SEO then when the page is displayed there would be code to display that. When you switch themes the data that you entered for Page Description remains in the database (the data is preserved) but the new theme probably won't be calling that information. In essense the more customized your current theme the more difficult to switch to another theme.

This is an aside for everyone else, but this right here is why you NEVER EVER EVER EVER NEVER EVER NEVER NEVER NERVER NEEEEEEVER add custom data to your theme, you add it to a plugin. Even if you're selling themes, you should include a plugin with your theme and not hard code it. I know people do it all the time but it makes me want to punch their faces.

Kevin Korte
Kevin Korte
28,149 Points

Make sure in your new theme you're using all of the same templates, with the same hooks inside of them. Than you can change your html structure, and restyle it with CSS and it should be a smooth transition.

Basically though you do not want to change the PHP tags in each template.