Is There Still a Space for Building With HTML, CSS, and Template Tags? – WP Tavern

I’m still wondering about the best method to approach a new project.

As a background, besides the traditional way, I’ve worked with Divi, love Bricks, and am loving Blocks. But I still feel that there is nothing like building a website from the root, with raw material: HTML, dynamic PHP, and CSS — even more now with the importance of performance and the new server-side of things.

Plus, the ability to play with dynamic data (and the database) with template tags is so smooth and efficient that it really feels like superpowers.

So, it feels a bit strange, but I’m wondering if template tags are going to end too?

Ricardo

You are asking a guy who was so nostalgic for the “simpler” days that he built his own custom blogging system over a weekend. And, I actually still use that same code, albeit updated and refined, for my personal blog today. When I began that project, I laid the foundation with modern PHP and build tools. However, at the heart of it, I just wanted to get back to those foundational elements of the web: HTML and CSS. I feel where you are coming from.

That project was fun to build for my own edification and enjoyment, but it essentially has a user base of one. Designing the front end for it feels very much like WordPress of 10 – 15 years ago.

When you said using template tags was like accessing “superpowers,” it brought on a wave of nostalgia of those days and weeks when I first started using them. It was such an elegant system. Anyone could grab some dynamic data by copying a code snippet and pasting it between some HTML elements.

For those with the skills or enough DIY grit, they can do anything with a little bit of code, trial-and-error, and time. However, if we are going to empower more people, developers need newer and more powerful technologies to make that possible. For WordPress development, that means embracing the block system, which seems like something you are doing.

Template tags are not going away. They are just PHP functions for getting some type of data. They will be around for a long time, likely as long as WordPress itself is still kicking.

Many blocks actually rely on these template tags for outputting dynamic data on the front end. For example, the Archives block is literally a wrapper around wp_get_archives().

If you prefer working from a code editor, you could look at blocks as modern-day template tags for WordPress. They are merely snippets of HTML code with a bit of JSON mixed in as an HTML comment. Many also display dynamic data.

There is really no difference between the following template tag:

<?php wp_get_archives() ?>

And its block equivalent:

<!– wp:archives /–>

Both spit out dynamic data. The difference is the syntax.

Granted, that is one of the simplest examples. Sometimes the block code is more complex. Other times, not so much.

What makes blocks more flexible is that they are built on a standardized system that empowers users to interact with them on the admin side.

Web development is an industry where you must continually adapt, learning new syntaxes, programming languages, libraries, technologies, and more. Just when you think you have mastered one thing, something else comes along to toss your world upside down. It can be both frustrating and fun. Over time, you just learn to roll with it.

While template tags are not going away, how front-end developers build will change in the coming years. For most projects, they will work with blocks. However, block theming is in its infancy, so it is not something anyone must rush into.

With that said, the beauty of WordPress is that there is no one way of using it. If you want to build with just the raw materials, you can always do that. It may even make some projects easier, particularly if you have a simplified scope.

As far as performance goes, WordPress is pretty fast out of the box. Plugins and the active theme can improve its speed or make it a lot worse. Thanks to some improvements in 5.8, block styles are far more efficient.

It sounds to me that we are kindred spirits. We appreciate the simplicity — at least what we personally view as simple — of just diving into the building blocks of the web. And, there is nothing wrong with that.

However, as a professional, you are building themes for customers or performing a service for a client. The technology or the tools you use do not really matter as long as they allow you to cater to your users.

Maybe that tool is a third-party page builder on a client site. Perhaps you are building a block theme for public release on top of WordPress. Or, it could be a personal project, an itch you have been wanting to scratch. You load your code editor and begin tapping the keys. After a weekend of caffeine and junk food, you realize you have built something new and exciting from the ground up.

Whatever your new project is, approach it based on what the project itself needs.

Like this:

Like Loading…

Source link

Justin Tadlock