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

Eric Nevitt
Eric Nevitt
4,914 Points

Completely confused on how to upload a template

I have made a template in HTML and CSS and now I want to upload to WordPress. I watched the videos on how to put the template into WP, but I'm completely lost. I'm going to watch the PHP section today. I'm hoping it helps. I understand that I need to make my template into PHP. That's where I got lost.

Really wish there had been code to go along with the videos, it would have cleared things up.

Not sure if this helps or not, but there is some PHP code instructions listed here: http://codex.wordpress.org/Theme_Development

I have never created my own theme for Wordpress before, I have always just taken an existing theme and modified it to suit my needs, so this may be of no use to you, but I hope it gets you closer to what you want to achieve!

22 Answers

Eric Nevitt
Eric Nevitt
4,914 Points

Thanks Aaron. I will have to take a longer look at that. I looked briefly at it and it looked like it might help.

Eric Nevitt
Eric Nevitt
4,914 Points

Thanks Kevin! It does answer a lot of them.

Matt Campbell
Matt Campbell
9,767 Points

WordPress is written in PHP and all the WordPress hooks follow PHP so I recommend learning that and then WordPress makes a lot more sense. It's not just a case of putting an HTML and CSS doc in WordPress. It needs hybridising for WordPress.

Eric Nevitt
Eric Nevitt
4,914 Points

Thank y'all. I'm gathering that there's no way of learning WP without PHP. It's OK I like php better than any other programming language.

Matt Campbell
Matt Campbell
9,767 Points

Not really no. If you want to understand how WordPress works you need to know it the same you need to know HTML and CSS and javaScript. You can use WordPress without these things but only as a user rather then a developer. Hope that makes sense.

Eric Nevitt
Eric Nevitt
4,914 Points

I can use my own template for this project right?

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hey Eric Nevitt this is exactly what we designed our How to Build a WordPress Theme project to address! Hope that helps :)

Eric Nevitt
Eric Nevitt
4,914 Points

After about the third video I was completely confused. I'm going to watch it again now and see if it makes more sense after I read the Bootstrap article.

Zac and the other staff here keep up the good work!

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

The confusion might be because that project really takes a big picture look at the entire theme building process. The blog article may give a little more targeted help, but the bottom line is you'll have to build a theme with all the php and WordPress code a WP theme requires and then upload it to your wp-content > themes folder.

Hope that helps! Let us know if you hit any snags :)

Eric Nevitt
Eric Nevitt
4,914 Points

The last set of videos about setting up a template from a static site is where I got lost. It would be great to have some code to follow with the video. That way you can hear about the code and see what the code looks like. It seemed a bit rushed to me.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Yeah, I hear you. With this project we did not have code challenges or code to download along the way but we likely will with the next project.

If enough folks ask for it though I may try to go back and add some of the code for download if I can.

ADD THE CODE!!! Okay, I'll settle down. But yes, having the code available to peruse would be MIGHTY helpful. The videos are great, but they can go by quickly. Even replay/pause/rewind/repeat isn't the same as browsing through the entire code file.

Eric Nevitt
Eric Nevitt
4,914 Points

Thanks sir. When is the next project going to be open? Is there anything on HTML5 here? I know HTML 4 pretty well, but the world is wanting 5 now.

Eric Nevitt
Eric Nevitt
4,914 Points

I'm not finding my HTML button in the admin panel. All I see is visual and text buttons.

The text button is where you would put your HTML for a page.

Eric Nevitt
Eric Nevitt
4,914 Points

On my main menu there is no place to log in. How do I add that to my site?

For a user/member to login? I'd be browsing wordpress.org/plugins to add that functionality.

Eric Nevitt
Eric Nevitt
4,914 Points

Shouldn't there be an "automatic" one that allows you to log in to the dash board?

The admin login to get to the WordPress dashboard? To get there, just add /wp-admin/ to the end of your URL.

Eric Nevitt
Eric Nevitt
4,914 Points

I understand that. I am just curious if there was a automatic log in on the menu bar or if you had to add that.

No. That would be something you would add. Most WordPress sites don't advertise the way to login to the admin area. Most visitors to websites don't have access; those that do use the /wp-admin/ URL.

Eric Nevitt
Eric Nevitt
4,914 Points

That makes sense. No need to advertise to any one who wants to experiment with hacking into sites. The pros will know about add /wp-admin/

Eric Nevitt
Eric Nevitt
4,914 Points

The next question I have is about the functions.php. Where it says wpbootstrap_scripts_with_jquery() I use the the name of the theme I'm creating right?

<?php

function wpbootstrap_scripts_with_jquery() { // Register the script like this for a theme: wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );

if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', )); ?>

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

No, that function would work if you didn't change anything, but its not a bad practice to "namespace" your functions with your theme or plugin name.

Eric Nevitt
Eric Nevitt
4,914 Points

My index page isn't working right. It's not showing the content that is on the home page.

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Did you set the home page to be the front page under Settings > Reading ?

Eric Nevitt
Eric Nevitt
4,914 Points

wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) )

What if I don't have any JS at the moment? Do I need JS? All I have in my WP file is jquery.

Is there a way that I can share my code as I have it now?

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

If you aren't using any JS you don't have to include any :) if you don't have any JS you don't need to load jquery either.

Eric Nevitt
Eric Nevitt
4,914 Points

Yes I changed the settings to a static page for the front page and nothing happened. Everything works to the point of changing the index to just include the header and footer, after that every crashes.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Yeah, I think you're right we're looking at some code files needed at this point :). You can always save them as text files and throw them up on Dropbox.