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

PHP

How important is PHP in entry level WP development?

Hi All, I have a few WP development projects that I am anticipating starting soon. As such, I am trying to fill in as many gaps as possible in my knowledge before I begin them. How important is PHP in doing entry level WP development? Like should I pull all-nighters this weekend to wrap my head around it or is not necessarily that essential to do basic stuff? Thanks:)

9 Answers

I would personally think as long as you have an understanding of each php page, and template, and understand how each part works, then you should be OK. A grasp of child themes, and how to integrate them is also useful, as you need to understand where to make changes to override the parent template files. Style.css and functions.php would be a starting point.

What do you mean by WP Development? Creating a theme? Setting up custom post types and taxonomies for different data types?

If you just need to implement a posts and pages types of site you can probably get by with very little PHP knowledge.

Thank you Ben and Mike, so I am going to be customizing themes and adding plug ins for enhanced functionality. Given that, how important is php to me right now? Thank you, thank you!

For customizing themes, and adding plugins to WordPress I would say you need little PHP knowledge, right now. As you begin to use WP more then you'll become more acquainted with it, and the fundamental php structure.

Other than Treehouse I've always found Chris Coyier a hive of information when it comes to WordPress (his book's pretty thorough on all things WP too). Recommended read.

I would say with WP it's pretty important to know at least the basics. You can kind of guess your way through things right now but I would just watch some videos on treehouse so you at least know the basics. Otherwise things would get confusing as you start to modify things.

Thank you again Ben and Ricardo! This is all just the feedback I needed:)

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Great feedback folks! I would also say that for normal theme customization PHP is not as important as CSS and knowing how template tags and template files work.

Here is my suggestion for what you will want to brush up on our look into:

  • How to make child themes. If you customize a theme and then update it when a newer version is released. So, you should really make a child theme for any theme you're customizing. It's not hard and you can read more about it here: http://codex.wordpress.org/Child_Themes
  • CSS. A lot of your customizations are going to require editing the CSS. Again, you want to make sure you're working in a child theme style.css file and not the primary theme style.css file.
  • Template file hierarchy. WordPress has a structured templating system and it's really helpful to understand how this works so that you know what file to edit. For example, the single.php file is generally the file to edit if you want to update a single blog post page. Or front-page.php is the file if you have a static homepage that you want to edit.
  • Template tags. Template tags like the_title(), the_content() and the_author() are the special WordPress PHP functions that are used to display content from WordPress. Learning these is like learning CSS. It takes a while to memorize them all, but they're really easy to search for. Just search "display author template tag" and you'll find this: http://codex.wordpress.org/Author_Templates. You might want to just scroll through this list to get an idea of what you might find in a template. The reason you need to know very little PHP working with WordPress themes is that the majority of the code you write is WordPress template tags.
  • The Loop. Familiarize yourself with what is called the WordPress loop. You won't need to edit or create any loops, but most of the page content you will need to edit is inside of loops.
  • Include tags. Often developers will include files inside of templates to keep the code easy to edit and more modular. Check out this for the include tags: http://codex.wordpress.org/Include_Tags

Other than that, I think you're going to find working in WordPress templates pretty easy and rewarding. I think it's a great place to start learning PHP, actually.

A related note: Some premium themes are quite complex and it will take a lot of clicking around in the admin area and looking over the theme documentation before you get everything setup correctly. So don't get frustrated, this is normal!

Hope this helps :)

Good point, the template hierarchy is hugely important to know which file to edit. It can be very frustrating poking around looking for the template that's rendering the output you want to alter.

The diagram on this page is useful: http://codex.wordpress.org/Template_Hierarchy

A lot of people learn PHP through WordPress. I just wish WordPress didn't do things like echoing directly from functions, reliance on global variables, inconsistent function names and opening and closing the PHP tags on almost every line, even with no HTML in between.

Hi Zac, I am enjoying your course and really appreciate all you shared here. Thank you! And Mike, I love the diagram, thank you too!