Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress Templates for Beginners

WordPress Templates For Beginners: Timber

Since talking about WordPress templating, I’ve covered some different engines that are available:

If you’re looking at Mustache, then you may be interested in Handlebars, and if you’re looking at Blade, then I highly recommend checking out Sage from the Roots team.

WordPress Templates: Sage

But for this final post, I’m going to continue with Timber which is what I introduced yesterday. I’m not so much about which is being used (as they all have their tradeoffs) as long as it’s consistent.

Continue reading

WordPress Templates for Beginners: What’s Templating, Anyway?

When talking about templating, regarding of if its WordPress templating, JavaScript templating, or templating in some other language, I think it’s helpful to use a concrete project or example to walk through how it works rather than talk about it in more esoteric terms.

If you’ve not been following along with this series and you’re just getting started with templating, I recommend reading the first two parts of the series:

  1. How It Is
  2. HTML Calling PHP

From there, we’re going to break down the concept into two parts:

  1. understanding what templating is,
  2. how templating can work within WordPress.

The challenge, of course, comes in that we have “WordPress templates” and then we’re talking about using a templating engine to change up WordPress templates, how they work, how data is injected into them, and so on.

But I’ll do my best to try to clarify each part.

Continue reading

WordPress Templates for Beginners: HTML Calling PHP

Yesterday, I sketched out how to conceptualize how many of us are likely used to working with WordPress templates.

Though the separation of concerns with CSS and JavaScript is solid, templates are problematic whenever there is a lot of PHP mixed with our markup.

To be clear, we can’t help but include template tags because that’s the nature of how WordPress and general PHP-based content management systems work.

The problem comes whenever we’re working with templates that contain code making more complex calls to various APIs. Though I demonstrated this using WP_Query (and will continue to do so), it’s not just that query.

Anyway, though, what are we supposed to do with this?

Continue reading

WordPress Templates for Beginners: How It Is

When I first started thinking about templating in WordPress, I thought about regarding two aspects:

  1. content specifically for members,
  2. content that could break down into a single post.

But the more I thought about it, the more I realized that it could (and arguably should) be explained over the course of a few posts.

So I’m going be breaking down the current state of WordPress templating and then practical ways we can take organize, say, our plugins so that we’re using standard PHP.

After that, in a future series, I’ll look at what it means to use other templating engines (both PHP and JavaScript in the work we do).

For starts, though, I want to take a look how we often see templates written within the context of both WordPress themes and plugins.

Continue reading

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑