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 trialDerek Hollister
537 PointsStatic Site to WordPress Theme?
I have a static site built with HTML/SCSS/JS that I now need to convert(?) to a WordPress Theme. I've been following the WordPress Development track and honestly, am a little stuck as to where to start. I have most of the site built out (I say most because some pages are essentially templates for whole sections), including desktop and mobile navigation, sliders, etc.
Wordpress is just a tad overwhelming at first. I have some sections that I need to be customizable via WordPress and others that can stay static for the time being. Any recommendations on where to even begin?
For my next build should I use a WordPress template like _s?
2 Answers
Kevin Korte
28,149 PointsI'd just start at the front-page and work your way back. Follow the template hierarchy and start copying your static code into those templates.
You can than start to refactor in the areas you want the dynamic parts that wordpress add.
Jose Balaguer
17,473 PointsAre you doing that for adding a blog? Your html page doesn't work? I'm asking because if You only want to add a blog to your site you can:
- install WP in another directory;
- style the WordPress CSS matching your html page;
- and link the blog in your html navigation menu. If it's the case this will save you a ton of work.
Derek Hollister
537 PointsLong story short, I was under the impression that to build a wordpress theme, I'd have to build it static-ly and then somehow convert it with php tags. After building most of it, I found out otherwise and now feel kind of stuck. Most of the site should be editable, minus one or two pages that will be hard coded so the client can't screw with it.
Jonathan Grieve
Treehouse Moderator 91,253 PointsYou will need a little bit of php knowledge but unless your site is going to bed dramatically different from the project in the Wordpress Theme Development course, you'll be able to look back at those videos to get an idea for what you need to do in each stage of your building.
It will give you an idea of what the template hierarchy is and how it links together.
It'll help you memorise the file structure in a Wordpress Installation.
How to edit code and which php tags to use to dynamically add content to your Wordpress website.
It's just going to take practice. :-)
Jose Balaguer
17,473 PointsI've never done a conversion. Sorry :/
Derek Hollister
537 PointsDerek Hollister
537 PointsThat makes sense, thanks Kevin, I appreciate the help! Sounds like I'll just have to do a lot of copy/pasta.
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsYou do, only because wordpress only leaves you with having to basically do the html, css, and js of your fully cms site. Sure there is some php you might have to add, but it's specific and well documented functions inside the wordpress ecosystem, so it shouldn't be too hard to do.
Sounds like you have the hard part over.
Derek Hollister
537 PointsDerek Hollister
537 PointsKevin Korte - Phew, that's a relief then! So would you recommend for future builds going the route of building static-ly and then 'hooking up' WordPress or working differently?
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsYou can...it's whatever workflow you find easiest. I tend to build in wordpress, but build statically first, just get my templates right, and than start introducing the dynamic parts.
Unless I have something that 100% is dynamic. Than I just do it from scratch.
Derek Hollister
537 PointsDerek Hollister
537 PointsThat makes sense. Do you have any recommended resources for the workflow you follow? sorry for all the questions, I'm a bit new to the WP world.
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsNo worries on the amount of questions. I don't really, probably the best I could point you to is Css-Tricks. They talk about wordpress a lot there.
My process isn't pretty, it's back and forth a lot honestly.
I don't completely button down a design, because wordpress may interject it's own html and css, and I have to account for that. For instance, photo galleries. Wordpress has it's own markup for it. It will be different than you had your static files. There are ways to completely overwrite the default html output from WP in those situations, but it's a lot of work. Eventually you'll learn what type of things in wordpress will need special attention (photo galleries), and which other ones really don't.