Ask the Bartender: Is There Still a Space for Building With HTML, CSS, and Template Tags?

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.

How to Use SmartCrawl’s Schema Types Builder: Advanced Features

This article introduces you to advanced features of SmartCrawl that will help make configuring supported complex schema types on your WordPress site easier.

SmartCrawl Schema Types Builder
Say hello to SmartCrawl’s Schema Types Builder’s advanced features.

Schema markup is code that helps search engines understand your content better and return more informative results for users in search results.

SmartCrawl, our free WordPress SEO plugin, offers full support for default schema types.

In this article, we’ll cover the following advanced features of SmartCrawl’s Schema Types Builder that will make it easier to work with the more complex schema types supported by the plugin:

Let’s jump right in…

Use Nested Properties in Schema Types

Schema properties can be simple or complex.

An example of a simple property is the Article Headline, which only requires a simple string value.

SmartCrawl: Schema Type Property - Article Headline
An Article Headline is an example of a simple schema property type.

On the other hand, complex properties consist of sub-properties, where each sub-property can have further sub-properties.

An example of a complex property type would be Article Publisher.

Schema type - Publisher
Schema type – Publisher.

Whereas a Headline accepts a simple string value, the Publisher property requires a complex entity of Organization type as its value.

The Organization type consists of multiple sub-properties, some of which are themselves complex types also consisting of sub-properties.

In SmartCrawl’s Schema Types Builder, this is represented as a tidy nested structure that helps you wrap your head around complex types and manage them with ease.

Article schema type with nested Publisher and Contact Point sub-properties.
Article schema type with nested Publisher and Contact Point sub-properties.

Add a Collection Using Repeaters

As you work with schema, you will often come across situations wherein it is valid to provide a collection of items for a property instead of a single item.

For such situations, SmartCrawl provides repeaters in its schema builder. Simply press the + button to add new items. There is no limit to the number of items you can include using repeaters.

For example you can click the + button repeatedly to add multiple reviews under the review property of Product schema type.

Schema property: Reviews - repeater
Use repeaters to add multiple items to schema types, like product reviews.

When you test the page in Google’s Rich Results Test tool you will see that all your reviews are individually recognized.

Another common use of repeaters is the Images property in the Article schema type.

Schema: Images property
Use the repeater feature to add multiple Images in the Schema Type Builder.

Make a Schema Your Own with Type Switching

One of the things that make schema confusing for many people is that one property can accept two or more entirely different entities as value.

For example, according to Google’s documentation, the Product offers property accepts either a collection of Offer objects or a single AggregateOffer representing all available offers as a single object.

Schema - Offers
Some schema sub-properties like Product offers accept multiple property choices.

SmartCrawl’s schema builder simplifies this complexity with a simple user interface that allows you to switch between available property types at the push of a button.

Product Offers - Property Type Switching feature.
Type switching lets you easily switch to the type that’s right for your needs.

Clicking the Change button opens up a dialog with all the available types that you can switch your property type to.

Change property type
Simply select one of the available types and click the “Change” button…that’s all there is to it!

The builder is also flexible enough to allow you to switch the type of a property located inside a repeater:

Change the type of this property.
Switch property types inside repeaters.

Make Schema Types Richer with Loops

While repeaters are definitely useful, sometimes there’s just too much data to add and it’s not possible to manually add each item into the schema builder. Not only that, but you have to continually make sure that data entered manually into the builder is in sync with the rest of your website.

Using the above Product example, repeaters allow you to add all your reviews to a product schema type, but what happens if you delete a review from your website?

With a repeater your only option would be to open the schema builder and delete the review there as well. As you can imagine, this is less than ideal.

Luckily, there is a much better way to achieve the same thing using a loop.

In programming, loops are a powerful tool that allow you to go through each item in a collection in turn and perform operations on it.

If this sounds scary, don’t worry. With SmartCrawl, you won’t need to hire a WordPress developer to do loops for you. Instead, we automatically include loops to make your schema types richer.

For example, you can add the optional Comments loop while working with the Article schema type.

To do this, simply click on the + Add Property button…

+ Add Property
Click the button to add a property.

In the Add Properties popup screen, select Comments and click + Add.

Schema: Add Property - Comments
Select Comments and click the button to add this property to your Article schema type.

This will insert a Comments block that will repeat for each post comment.

Schema property - Comments
A Comments block.

The above Comments block looks similar to all others but it’s different because instead of representing a single comment, it represents the list of all available post comments. Any changes you make in this block will be applied to each comment on the post.

If you test the post in Google’s Rich Results Test you will see each post comment individually represented.

Google Rich Results Test - Comments
Google Rich Results Test individually represents each comment in your post.

Easily Select Property Specific Values

For some properties, only certain values provided by Google or Schema.org are considered valid.

For example, take the Employment Type property available in Job Posting schema type. According to Google, you must use one of the following values, otherwise your schema will be considered invalid:

Job Posting Schema - Employment type
Certain properties require values, otherwise, the schema will be invalidated.

SmartCrawl includes the valid options for such properties into the Schema Type Builder, saving you the time and hassle of having to copy text back and forth.

Schema - Employment Type dropdown options.
SmartCrawl saves you time with built-in valid options added to properties that require values to be selected, like Employment Type.

Add Useful (But Not Critical) Optional Properties

If you sift through the documentation on Schema.org, you will notice the hundreds of first-level properties available for each schema type.

Screenshot of Schema.org documentation screen.
Schema types can have many first level properties. (Source: Schema.org)

What’s more, there is no indication which properties are important and which ones are not. It’s enough to make your head spin!

To keep things simple, SmartCrawl only displays the properties that are required by Google in its documentation. Other properties that might be useful but are not critical are hidden away as optional properties. To add them, just click the “Add Property” button.

For example, here are the optional properties for the Article schema type:

Schema: Add Properties - Article type
You can find optional (but not required) properties for each schema type in the Add Properties screen.

Keeping less important properties tucked away lets you focus on what’s important instead of being overwhelmed.

Check How Google Sees Your Schema with Validation

SmartCrawl lets you delete any property that you think is not suitable for your website.

Delete schema type property
Click on the trash icon to delete a schema type property.

However, if you delete a property required by Google, your schema might become invalid and prevent your markup from qualifying for Google’s rich results.

Fortunately, SmartCrawl’s schema builder will warn you if this happens and show you exactly where the problem is.

For example, suppose you delete the Author Name from your Article schema type.

First, you will get a warning message:

Delete property confirmation
If you try to delete a property that is required by Google, you will be asked to confirm this.

If you choose to go ahead anyway and delete the property type, you will then see a notice like this:

Property removed notice.
SmartCrawl displays notices like this when required properties are removed from your schema type.

Expanding the schema type will reveal that the problem exists in the Author property…

Missing schema property alert
Missing schema property alert.

Expanding the Author property and clicking the Add Property button within will then show you exactly which property(ies) you need to add for your schema to qualify for inclusion in Google’s rich results.

Add Properties - missing property
Include missing properties to make sure your content is eligible to display in Google’s rich results.

SmartCrawl – The Schema Redeemer

SmartCrawl’s Schema Type Builder includes a number of useful features that will help you save time when working with more complex schema types.

See our documentation for more details on using the plugin’s Schema Type Builder and check out these schema posts for how-to tutorials on using schemas with SmartCrawl:

Also, feel free to contact our 24/7 support team and visit our member’s forum if you need additional help or have questions…happy scheming!

341: Challenges

Marie and Chris talk about CodePen Challenges, which have been going strong for many years now. The gist is that you pop in and make something along a theme. The “challenge” is doing the work (they aren’t meant to be tricky otherwise). We’ve seen people seriously level up their skills by participating, but of course, there is no obligation, and no prizes other than the satisfaction of a job well done.

One interesting twist is that Chris used to do a lot of the challenges while Marie was running the podcast, but we just up and switched jobs and we both prefer our new jobs much better (for now!).

Time Jumps

  • 00:51 Explaining how time works
  • 01:45 Having monthly themes
  • 06:33 Sponsor: Netlify
  • 08:08 How to be a part of challenges
  • 13:03 Putting together the challenge collections
  • 17:04 Makes sense from a business perspective
  • 19:28 Swapping roles and creating more joy for everyone
  • 25:47 Using better dashboards to build fun things

Sponsor: Netlify

Just look at the October 2021 changelog at Netlify. They are always building things and making the features they offer better. We know firsthand how difficult that is to pull off, so hats off! One feature (BETA) that is definitely worth a look is On-Demand Builders. What a great idea for making your builds and deploys fast and efficient.

The post 341: Challenges appeared first on CodePen Blog.

Don’t Snore on CORS

Whatever, I just needed a title. Everyone’s favorite web security feature has crossed my desk a bunch of times lately and I always feel like that is a sign I should write something because that’s what blogging is.

The main problem with CORS is that developers don’t understand CORS. The basic concept of it is supposed to be easy: don’t run code across origins. Meaning if I, at css-tricks.com, try to fetch some JavaScript from an external URL, like any-other-website.com, the browser will just stop it by default. You’ll see an error in the console. Not allowed.

Unless, that is, the other website sends a header that specifically allows this. My domain can be whitelisted or there could be a wildcard that allows it. There is way more detail here (like preflighting and credentials) and, as ever, the MDN article does a good job on that front.

What have traditionally been hair-pulling moments for me are when CORS seems to behave inconsistently. Two requests will go through and a third will fail, which seems inexplicable, but was reproducible. (Perhaps there was a load balancer involved with half-cached headers? Who knows.) Or I’m trying to use a proxy and the proxy stops working. I can’t even remember all the examples, but I bet I’ve been in meetings trying to debug CORS issues over 100 times in my life.

Anyway, those times where CORS have crossed my desk recently:

  • This video, Learn CORS In 6 Minutes, has 10,000 likes and seems to have struck a chord with folks. A non-ironic npm install cors was the solution here.
  • You have to literally tell servers to have the correct headers. So, similar to the video above, I had to do that in a video about Cloudflare Workers, where I used cross-origin (but you don’t have to, which is actually a very cool feature of Cloudflare Workers).
  • Jake’s article “How to win at CORS” which includes a playground.
  • There are browser extensions (like ones for Firefox and Chrome) that yank in CORS headers for you, which feels like a questionable workaround, but I wouldn’t blame anybody for using in development.

The post Don’t Snore on CORS appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.

How To Use MaxScale Top Filter

In this blog, I am going to discuss using the MaxScale Top filter for query analysis and, in particular, how to use it to easily find the top slow queries for a particular user without using the slow log. The Top Filter is a great tool for query analysis. It can be enabled without downtime, and the logs don’t require storage space on the database server itself.

MaxScale is an advanced intelligent database proxy from MariaDB. It provides load balancing and high availability functionality and includes easy-to-use filtering capabilities. The MaxScale functionalities are implemented as modules. So it is easy to integrate the modules needed for your particular use case.

The Role of Data Matching in Big Data Business Strategy

“It is both staggering and exciting to imagine how data and analytic capabilities will transform entire industries.”

– Ariel Dora Stern

As promising as big data analytics sound, there’s still a huge gap between a company’s expectations with their data and the reality. In the article Companies love big data but lack the strategy to use it effectively, Harvard Business School shared some insights that they teach to executives:

When to Code a Stored Procedure — and When Not To

Though it might seem to be a weird title in 2021, you'll be shocked to learn the number of applications (legacy and new) that still use stored procedures.

The stored procedure is a database capability that allows developers to write code at the level of the database and directly manipulate data (and sometimes define data, i.e. create tables, indexes, drop them, etc.,).

9 Best PayPal Integration Plugins for WordPress

Best PayPal Integration Plugins for WordPressIf you’ve ever purchased or sold something online, there’s a good chance you used PayPal. In fact, millions of transactions are done using PayPal every single day and more than 1.6 million websites are using PayPal to handle their transactions. Simply put, PayPal is everywhere. But why is PayPal so popular? First, It gives customers […]

The post 9 Best PayPal Integration Plugins for WordPress appeared first on WPExplorer.

CockroachDB TIL: Volume 4

Topics

Topic 1: Reset Network and Execution Statistics in CLI

This topic will cover what trivial misconfigurations may lead to if you don't keep client and server versions uniform. These mismatched versions may lead to unforeseen consequences. This is one of those situations where a user reported missing info from their CLI. In this case, they were missing execution and network latency which we conveniently output after every query.

 
artem@free-tier.gcp-us-central1.cockroachlabs.cloud:26257/defaultdb> select * from results limit 1;

                   id                  |   city    |  type   |               owner_id               |    creation_time    | status |   current_location    |       ext

---------------------------------------+-----------+---------+--------------------------------------+---------------------+--------+-----------------------+-------------------

  aaaaaaaa-aaaa-4800-8000-00000000000a | amsterdam | scooter | c28f5c28-f5c2-4000-8000-000000000026 | 2019-01-02 03:04:05 | in_use | 62609 Stephanie Route | {"color": "red"}

(1 row)



Time: 49ms total (execution 2ms / network 48ms)

Specifically, the last line of the output above.

All You Need to Know About Automation Testing Life Cycle

Introduction

Testing has become standardized and more competent, and its processes are evolving every day. The technical adeptness of the testers also matters in the success of the complete testing stages. Testing no longer means discovering bugs only; its scope has broadened, and its importance can be seen right from the start of any development project.

When we talk about the automation testing life cycle, most of us believe it is just a part of SDLC, but it is a lot more than that. It is necessary to understand that automation testing should be a prominent part of the automation testing strategy and has a life cycle. Businesses have to adapt it to enhance the quality of their software products.

Mirai Variant Dark.IoT Expands Reach Beyond IoT Devices to Linux Servers Hosted in the Cloud in Attempt to Increase DDoS Capability

Radware researchers have found that a Mirai variant in development since February 2021 has continued to evolve, making it more capable and dangerous than ever. 

Back in August 2021, Radware reported that a Mirai variant campaign known as Dark.IoT had begun leveraging a vulnerability, CVE-2021-35395, in Realtek's SDK just days after its disclosure. Researchers named the botnet Dark.IoT, based on the use of "Dark.[architecture]" filenames for its malware binaries and the reoccurring use of "lmaoiot" variations throughout its infrastructure naming. 

Test-Driven Development With The oclif Testing Library: Part Two

In Part One of this series on the oclif testing library, we used a test-driven development approach to building our time-tracker CLI. We talked about the oclif framework, which helps developers dispense with the setup and boilerplate so that they can get to writing the meat of their CLI applications. We also talked about @oclif/test and @oclif/fancy-test, which take care of the repetitive setup and teardown so that developers can focus on writing their Mocha tests.

Our time-tracker application is a multi-command CLI. We’ve already written tests and implemented our first command for adding a new project to our tracker. Next, we’re going to write tests and implement our “start timer” command.

Why Continuous Performance Testing for Retail Apps Matters

The retail industry has been actively adopting digital transformation in order to provide a better user experience. According to current trends, the reliance on digital channels has been enormous, placing them at the core of all significant online retail operations.

Mobile sales increased by 68 percent in 2020 and are anticipated to surpass other channels as the largest source of all sales by the end of this year. Can you identify the true reason for increased sales using retail mobile applications? The answer is "digital confidence."