0

Ok so I am teaching myself how to code wordpress themes from scratch. I am using c9.io as an editor.

I had a question. I have been looking at different tutorials at the template files they use, and most consist of only one style.css file, and then the php files.

My question is this: When I was messing arounnd with HTML/CSS before it was much easier for me (making a multi-page website) to have multiple html/css files for each new page. I am aware that this isnt the best way to do things, but for now, I do really prefer that as I am having trouble customizing my theme the way i want with only the one style.css file.

is there a way to convert multiple html files and multiple CSS files for use in wordpress? I found this: https://thethemefoundry.com/blog/html-wordpress/ but im unsure how to apply this with multiple files. Is it even possible with wordpress?

1
  • If you're going to approach it like that, have you thought about instead using LESS/SASS and then compiling into one CSS file? LESS/SASS will help with your organization. Multiple CSS increases page load time.
    – Aibrean
    Jul 29, 2015 at 13:25

1 Answer 1

1

The short answer is yes: You can use multiple CSS files in a WordPress theme.

The main style.css file is used for holding the theme's information. You can leave the rest of it blank after that and write your own custom CSS files and include them inside the like you normally would.

As for the HTML, that will be working fairly different from a normal HTML based website. Instead of having an HTML file for each page (say home.html, about.html, contact.html) you will have one PHP file, called page.php. This file would be used to display the information that would be stored when you add a page from the WordPress dashboard (the title, the content, the date of creation etc.)

Being that most websites are laid out the same way, with a header, then the content, then the footer, with WordPress you would create a file called header.php which would have all the header content that goes on every page, footer.php which would have the footer content on all pages, and then the content part would be your page.php, which will look something like this.

<?php get_header(); ?>

    <?php the_content(); ?>

<?php get_footer(); ?>

Unless you are pretty familiar with PHP, and have a good understanding of modular design/code, you will probably want to follow a tutorial series all the way through and follow the design/layout that they are using before converting your own. That way you can get a feel for how WordPress coding is usually done.

Also, and this might be a little overwhelming to look at upon first glance, but this is the template hierarchy for WordPress. Once you get a grasp on how WordPress development works this will become your best friend.

http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

Good luck, WordPress development will change your life (in a good way) :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.