WordPress is known for its incredible versatility. The content management system (CMS) provides developers with many ways to customize both the front and back ends.
This opens a whole world of possibilities when it comes to form and function. The ability to create fully-custom themes and plugins offers a path to building virtually any type of website. But it doesn’t end there.
Features like custom post types and taxonomies, along with custom fields allow for highly-specialized content. It can be organized in a way that fits your needs like a glove.
In addition, there are an endless array of smaller customizations. Code snippets targeting hooks and filters let you tweak existing functionality even further. And we’re only scratching the surface of what’s possible.
However, with all of this power comes some responsibility. Customizing WordPress requires some planning. And there are several important factors to consider. So, before you fire up that code editor, here are some things you should know about the process.
A Staging Site is a Must-Have Feature for Testing
Creating some custom functionality for your WordPress website? Avoid building it directly on your production site if at all possible. There are simply too many things that can go wrong.
One false move can lead to usability/performance problems or even downtime. Perhaps it’s not as big of a deal on a small site with few visitors. But a busy eCommerce or membership website? That could cost you both sales and customer loyalty.
This underscores the importance of having a staging site. It provides a playground of sorts where customizations can be tested before being made public. The idea is to hopefully catch and repair any issues before they impact users.
What’s more, there are a number of ways to set up a staging environment. Some web hosts offer them as part of their services. But you can also create your own either online or on your local machine.
Testing this way is very much worth the extra effort.

The Method for Implementing Customizations Matters
Part of the beauty of WordPress is that you can implement custom code in a number of ways. But it also has the potential to become problematic.
For example, a custom code snippet can easily be placed into your theme’s functions.php
file. That is fine for the short term. But what happens when you change themes down the road?
Launching a redesign with a new theme will result in a loss of those customizations. And while moving any snippets to the new theme is possible, they could well get lost in the shuffle. Depending on the nature of the custom code, some key functionality may end up missing. In this type of situation, creating a custom plugin would be the more future-friendly solution.
When it comes to making changes to a third-party theme, there are similar considerations. Adding or editing code directly within the theme means potentially overwriting changes during an update. The best way around that issue is by utilizing a child theme.
The universal point is that, regardless of what you’re trying to achieve, it’s important to implement customizations in a way that will stand the test of time. Keeping things well-organized is also recommended so that you won’t have to search around in several different places to find what you need.

There Will Be Future Maintenance Requirements
Neither WordPress nor its ecosystem of themes and plugins remain static. They evolve with the times. That means the code we write today will likely need to be maintained on a regular basis.
This follows the evolution of WordPress itself, but also of the variety of languages and libraries it depends on. PHP, JavaScript libraries such as jQuery and React, and CSS are prime examples. A change to these dependencies can impact performance and whether or not a particular feature still works.
Not only that, but plugins and themes also have their own agendas to implement. New features are added at a breakneck speed in this competitive environment. The ever-shifting Gutenberg block editor is also a moving target. This can lead to more compatibility issues as new versions continually roll out.
Therefore, you’ll want to pay close attention to what’s happening in these areas. Changes to WordPress core, themes, plugins, or dependencies could directly impact your existing customizations.

Customizing WordPress Is Serious Business
The mere act of customizing WordPress is one thing. But going about it the right way is another. It’s not something to dive into without some serious thought.
It’s important to consider what you want to accomplish, how it will be implemented, and how to keep it running smoothly into the future. The answers often come down to planning ahead and following best practices.
If you’re extending the functionality of WordPress itself or a plugin, read up on the documentation. There are likely some established methods built-in for getting the results you need.
The other side of the coin involves staying within coding standards. For example, eschewing any deprecated PHP or JavaScript and opting for the latest stable techniques. This will keep your code compliant and hopefully easier to maintain over time.
Keeping these things in mind will lead to more complete and sustainable results. That’s something that will benefit every WordPress developer.
The post Things You Should Know Before Customizing WordPress appeared first on Speckyboy Design Magazine.
In March, news broke that two malicious commits were introduced onto the in-development PHP 8.1 branch by perpetrators pretending to be Rasmus Lerdorf and Nikita Popov. The response by the PHP community to this attack was a shining example of the openness and transparency of the open-source world.
We’re going to take a closer look at the PHP 8.1 story to uncover what lessons there are to be learned on the value of visibility in coding.
Package:
Summary:
Get values of the current computer devices
Groups:
Author:
Description:
This package can get values of the current computer devices...
Read more at https://www.phpclasses.org/package/12157-PHP-Get-values-of-the-current-computer-devices.html#2021-07-19-16:47:56
Package:
Summary:
Assemble a neural network that can learn patterns
Groups:
Author:
Description:
This package can assemble a neural network that can learn patterns...
Read more at https://www.phpclasses.org/package/12151-PHP-Assemble-a-neural-network-that-can-learn-patterns.html#2021-07-19-16:20:26
In this episode, Josepha Haden Chomphosy discusses the importance of Diversity, Equity, and Inclusion to the fabric of the WordPress project and how we can move from a place of welcoming it to cherishing it.
Have a question you’d like answered? You can submit them to wpbriefing@wordpress.org, either written or as a voice recording.
Credits
Editor: Dustin Hartzler
Logo: Beatriz Fialho
Production: Chloé Bringmann
Song: Fearless First by Kevin MacLeod
References
Diversity Speaker Training Workshop
A WordPress Dinner Party
The Burden of Proof
Leadership At Any Level
Building a Culture of Safety
Leadership Basics: Ethics in Communication
WordPress 5.6
Transcript
Josepha Haden Chomphosy 00:10
Hello, everyone, and welcome to the WordPress Briefing, the podcast where you can catch quick explanations of the ideas behind the WordPress open source project, some insight into the community that supports it, and get a small list of big things coming up in the next two weeks. I’m your host, Joseph Haden Chomphosy. And before we get started, I have to be honest with you all, this episode and the next one have made me feel really anxious. This one is about Diversity, Equity, and Inclusion in open source, and especially in WordPress. And the next one is about accessibility in WordPress. And I feel like there’s just so much to do, and we don’t do enough, but we do what we can. And still, we will never be done with that work. And if you don’t know what I mean by Diversity, Equity, and Inclusion, you can kind of think of it this way. Diversity is bringing in people with different viewpoints and lived experiences. Equity is making sure everyone has what they need to get a fair chance of success, which is different from equality. And Inclusion is making sure that the environment is built to not only tolerate diverse groups but to celebrate them as well. So remember this as you listen to what I have to say here. We are never where we want to be in either of those spaces. But that shouldn’t stop us from looking at the things we have done to get us in the right direction. All right. Here we go.
Josepha Haden Chomphosy 01:54
I say a lot that we are a project that serves a majority collection of minority voices. WordPress is global in reach and open source in nature. And you would assume that what allows the software to be used by anyone would also enable it to be built by anyone. After all, your location doesn’t matter, and who employs you also doesn’t matter. And your relative social standing certainly shouldn’t matter. As long as you can communicate with the others contributing to the project, there should be no obstacle to your participation. The mission of the WordPress project is to democratize publishing, right? It’s to get the ability to have a website tap into passive income on your web presence. I mean, the job is to level the playing field for everyone. However, it’s my experience that bringing in new voices takes a lot of proactive work on behalf of leaders and contributors. It’s not enough to say, “Hey, I’m having a party,” you also have to say, “I’m having a party, and I’d like you to be there.” It’s not enough to think people will make their own space at this table. You have to make sure that you have table settings for everyone. And even beyond the basics of directing people to you.
Josepha Haden Chomphosy 03:12
And on toward the next steps, you have to be honest about the fact that open source contribution requires a fair amount of privilege. By privilege, I mean the luxury of extra time or extra funding or just an understanding employer. WordPress supports 41% of the web. I think it’s 42% of the web right now. But less than 1% of people who use WordPress show up to help maintain it. And that 1% that does show up skews toward people who already have a pretty high level of representation and technology. And so, when you look at who is building it versus who is using it, it doesn’t always match. And since what we build so frequently reflects who we are, sometimes what we build doesn’t match the needs of the people who are using what we have.
Josepha Haden Chomphosy 04:10
So what has WordPress done to be proactive on the question of Diversity, Equity, and Inclusion? There are quite a few unseen things that have gone into this over the years and a few pretty visible things. This is a very long list. And it has a whole lot of just reference material. And so the show notes today will come in handy for people, and there will be just a laundry list of linked resources for everyone.
Josepha Haden Chomphosy 04:39
But the first thing that WordPress has done is that we have accepted the burden of proof. I’m going to share a post about this in the show notes. That means we accept that it’s not the job of underrepresented folks to figure out if they are welcome. It’s up to us to make it clear that they are. So, there are three big little things that the community has done over the years. One is that many teams open their text-based meetings with an explanation of what is done in the meeting, who comes to the meetings, where to find help if you’re lost in the meeting, and for teams that have a specific type of requests that comes into those channels that aren’t handled in those channels. They also will share where people can go to get those requests taken care of. Many teams have also updated their team handbooks to have good beginner docs, limited use of inside jokes or jargon, and good first bugs. And also, there is a code of conduct in the community declaring that everyone is welcome and clarifies what to do if you see folks being unwelcoming.
Josepha Haden Chomphosy 05:51
A second big thing that folks in the WordPress community have done is written down what was unwritten. Having things clearly documented unlocks institutional knowledge that you’d otherwise have to know someone to get. Clarity and process and the structure help anyone engage with your organization, not just the people who have extra time to figure things out. What that looks like in the WordPress project is that many teams have documented their workflows and their working spaces and just their general team norms. Many teams have also started defining what it means to be a team rep and holding open processes to choose those team reps. Many other community leaders and I have written down countless unspoken rules, guidelines, and philosophical underpinnings so that people don’t have to guess what we’re doing or why we’re doing things, or where we want to do them.
Josepha Haden Chomphosy 06:46
And the more visible thing that the WordPress project has been doing is that we found ways to invite people in, and they’re not failsafe; they’re not foolproof, but it is certainly a step in the right direction. The first one is an ongoing, diverse speaker training initiative. And I’ll include a link to that in the show notes as well. It is run by Jill Binder and a fantastic group of contributors that collaborate with her. And I really have loved watching that particular program grow and flourish and help WordPress make a difference where we absolutely can.
Josepha Haden Chomphosy 07:27
The second thing that was pretty visible about how we invited people in was at the end of 2020, and we had an all-women and nonbinary release squad for our biggest release of the year; WordPress 5.6. I had a group of probably 70 women and nonbinary identifying folx who joined in the process and joined in learning more about the process. Some of them have continued in the project. Others have stepped away for various reasons. But all of them are welcome to return. And I encourage everyone to return to contribution when time and resources make that possible for you.
Josepha Haden Chomphosy 08:09
And then the third thing that we’ve done, which I have talked about a lot, is the revival of the testing and triage practices. That has been work that’s been ongoing for a number of years. And it happens across multiple teams. It is not always immediately clear to people why the testing work. And the triage work is identifiable for me as a way to invite people into this process. And so I’ll be briefly clear about it right now. So testing as a practice brings in the users that otherwise don’t have a lot of spare time and that extra privilege to like, figure out what’s going on with WordPress, and contribute their own fixes to problems. They can give back to this project by being co-developers with us, co-creators with our entire process of making WordPress real and usable for the largest number of people that we can because we now support 42% of the web. And then, the triage practice invites in a diverse voice of people. Because you don’t necessarily always need to know everything about a project to help with triage. And when you’re helping with triage, you get active learning through participating in the process. But you also get passive learning from the people who already know huge amounts about the project and the process and everything that goes into it. And so it’s a low key low stress way to get your feet wet and start building that knowledge that sometimes is hard to come by unless you are actively working in it. So the testing practices, the triage practices, I really to the core of my being believe that those are active and ongoing ways for us to invite people who otherwise wouldn’t have a chance to get their voices heard in an open source project. And y’all, as I said at the start, y’all, there’s nothing about this list that I just shared, which makes me feel like our work on this is done. Just like any muscle, you don’t fight to peak fitness, and then hit the big stop button on time and say, “Now, I never have to work out again.” If we did, the world would be a very different place probably. But it does then lead us to the next steps for fostering a community culture that’s as broad as the people who use this software. If you believe in leadership at any level, as I do, there are a ton of things that you can do right now. But I’ll boil them down into three big chunks of things.
Josepha Haden Chomphosy 10:54
First, check your community area, or whatever community you want to apply this to, for things that need a little more proactive work. I will share a post called Building A Culture of Safety that will take you through a list of good first steps. And it is not as hard as it looks. When you say build a culture of safety, there are many really clear-cut minor changes that you can ask people to make and, in like, four or five different areas that can help your community be more welcoming and more open.
Josepha Haden Chomphosy 11:30
The second thing that you can do is know that small changes add up over time and commit to making those changes where you can. If you are elite at any level, you know that supporting people and processes is the responsibility of everyone in the group. And if you can make your own autonomous decisions and commit to making small changes that make a big difference over time, you will be part of that solution. And that is not specific to any one group that we have in our communities. You can be an ally for anyone, whether they look like you, whether they have your same experiences, or not. And sometimes, it’s as easy as just holding space for the people who haven’t had a chance to talk yet. And on the subject of holding space and the way that we communicate.
Josepha Haden Chomphosy 12:22
The third thing that I think is incredibly important is that you can take on as a foundational personal practice the concept of ethical communication. I’ll share a post about that as well in the show notes, but the core of it is that you have to know that what you say and don’t say what you do and don’t do has an impact on others and embrace that responsibility. All right, so you made it all the way through, and I am so proud of you. I’m sure you have questions about this. And I encourage you to share those. You can email them to me at wp briefing@wordpress.org.
Josepha Haden Chomphosy 13:10
This brings us to our small list of big things. I’ve got two things for you today. First and foremost, WordPress 5.8 gets released tomorrow. It’s a big release, and lots of people have been working on it. So get your update processes ready and keep an eye on wordpress.org/news for the announcement post. Second, and still pretty important, team reps have been working on their quarterly check-ins so that all other teams can get an idea of what’s happening around the WordPress office. Keep an eye out for that post on make.wordpress.org/updates. And that is your smallest of big things. Thank you for tuning in today for the WordPress Briefing. I’m your host Joseph Hayden Chomphosy, and I’ll see you again in a couple of weeks.
One thing that's quite convenient is to be able to throw an exception with a valid HTTP code set and have that code sent to the client.
For example, you may have:
throw new \RuntimeException("Not Found", 404);
With the standard Slim 4 error handler, this response is sent to the client:
$ curl -i -H "Accept:application/json" http://localhost:8888
HTTP/1.1 500 Internal Server Error
Host: localhost:8888
Content-type: application/json
{
"message": "Slim Application Error"
}
Ideally we want the status code to be 404.
Option 1: Use an HttpException
The simplest solution is to use one of Slim's HttpException classes:
use Slim\Exception\HttpNotFoundException;
...
throw new HttpNotFoundException($request);
This is only useful in a Request Handler as you need a Request object, but the expected response is sent to the client:
$ curl -i -H "Accept:application/json" http://localhost:8888
HTTP/1.1 404 Not Found
Host: localhost:8888
Content-type: application/json
{
"message": "404 Not Found"
}
Simple and easy!
Option 2: Override the ErrorMiddleware
There are situation when you can't simply replace the exception thrown. For example, you're updating an application from Slim 3 and you have hundreds of customised exceptions already throwing, or you throw from a class that doesn't have a Request object instance available.
In these cases, the easiest solution is to extend the Slim ErrorMiddleware to wrap the exception in an
HttpException
and then the standard error handling and rendering will "just work".
I'm feeling a little lazy, so let's use an anonymous class to do replace the call to $app->addErrorMiddleware():
$container = $app->getContainer();
$logger = $container->has(LoggerInterface::class) ?$container->get(LoggerInterface::class) : null;
$errorMiddleware = new class (
callableResolver: $app->getCallableResolver(),
responseFactory: $app->getResponseFactory(),
displayErrorDetails: false,
logErrors: true,
logErrorDetails: true,
logger: $logger
) extends \Slim\Middleware\ErrorMiddleware {
public function handleException(
ServerRequestInterface $request,
Throwable $exception
): \Psr\Http\Message\ResponseInterface
{
// determine that this exception should be wrapped. I'm checking for code between 400 & 599
if ($exception->getCode() >= 400 && $exception->getCode() < 600) {
// wrap the exception in an HttpException
$exception = new \Slim\Exception\HttpException(
$request,
$exception->getMessage(),
$exception->getCode(),
$exception
);
$exception->setTitle($exception->getMessage());
}
return parent::handleException($request, $exception);
}
};
$app->addMiddleware($errorMiddleware);
Behind the scenes of $app->addErrorMiddleware(), the \Slim\Middleware\ErrorMiddleware is constructed and then added to the middleware stack. We replicate that we an anonymous class that overrides handleException() to wrap the thrown exception if required.
Looking at the code in detail
There's quite a lot going on here, so let's break it down into parts.
$container = $app->getContainer();
$logger = $container->has(LoggerInterface::class) ?$container->get(LoggerInterface::class) : null;
$errorMiddleware = new class (
callableResolver: $app->getCallableResolver(),
responseFactory: $app->getResponseFactory(),
displayErrorDetails: false,
logErrors: true,
logErrorDetails: true,
logger: $logger
) extends \Slim\Middleware\ErrorMiddleware {
The constructor to \Slim\Middleware\ErrorMiddleware takes 6 parameters, so when we instantiate, we have to pass them all in though it's not unusual for the $logger parameter to be left off in the call to $app->addErrorMiddleware(). The easiest way to get a logger instance if there is one, is to grab it from the container where it should be registered under the \Psr\Log\LoggerInterface key which is imported into the file with a use statement.
I've used PHP 8's named arguments as this constructor takes three booleans and it's easier to remember what they do if they are label
Truncated by Planet PHP, read more at the original (another 2865 bytes)
Latest PEAR Releases:
We say it all the time because it’s true: CSS and JavaScript are capable of some amazing feats. Web-based animation is a prime example.
Not long ago, animation on the web was a bit rudimentary – save for add-on technology such as Flash. The movements were basic and often trended towards cartoonish. That’s not necessarily a bad thing, just not a great fit for every project.
What if you’re looking for something more realistic – almost cinematic in quality? These days, CSS and the right JavaScript library can help you get there.
To prove it, we’ve found some beautiful code snippets that bring an element of realism to web animation. They range from full-on recreations to examples that use a just hint of real-world effects. Enjoy!
You might also like our collection of Snippets for Creating Neumorphic UIs
Power On
The toggle switch has become a staple of web design – but this snippet takes things to another level. By adding a realistic surface and jittery backlight, this pure CSS animation looks like it belongs on a piece of machinery. Clicking the switch also produces a satisfying on/off effect.
See the Pen Realistic Red Switch (Pure CSS) by Yoav Kadosh
Something to Sea
A shimmering ocean. Dolphins playfully leaping. All of this was crafted with…JavaScript? That’s right. The special effects here are just stunning. The light dancing off the gentle waves, the natural movements, and impressive shadows are all powered by code.
See the Pen Dolphins at dawn 🐬 by Dilum
Looking Down
Here’s a unique example of parallax scrolling. The large bird’s eye view photo of a city is eye-catching in its own right. But move your cursor, and the perspective shifts as if you’re standing atop a building, looking down on the world below. It’s subtle but oh-so-cool.
See the Pen Bird’s Eye View Parallax by Sharna Hossain (@sharnajh)
Exploring Mother Earth
Taking things even further out into the stratosphere, this snippet offers an interactive look at Earth, powered by Three.js. Left to itself, the planet slowly spins while a field of stars moves in the background. But there’s more! Click and drag the screen to change the planet’s position to suit your liking. Hint: there’s a moon hidden in there somewhere.
See the Pen 3D Earth by Bryan Jones
Nintendo Switch Demo
This gaming device animation takes a different, and perhaps more classic, approach. A neumorphic Nintendo Switch acts as a container for a video from the popular game Animal Crossing: New Horizons. Put it all together, and it looks like the game is being played right in front of you.
See the Pen CSS Nintendo Switch (Box shadow + Gradient practice) by Elisabeth Diang
Subtle Smoke
The beauty of this snippet is in its subtlety. The hero area utilizes an attention-grabbing photo background of a volcano. Slow-moving wisps of smoke (powered by CSS) provide the perfect accent piece. It goes to show that the little details can make a world of difference.
See the Pen Animated hero image with CSS clipping by Mihael Tomić
Rays of Light
Driving through the mountains can be inspiring. This animation will bring some of that experience to your screen. It’s the lighting effects that really impress. As the sun rises and sets, check out the intensity, shadows, and movement. You can almost feel the heat!
See the Pen Solar Quartet – JS1K 2018 writeup by yonatan
Just Watch This
Those of us who grew up in the 1980s and 1990s will remember these digital watches. It seemed like every kid had one. Not only does this snippet recreate the look of a classic Casio, but it’s also interactive. Click the “Light” button on the upper left to get a nighttime view of the screen. Ah, the memories.
See the Pen CASIO F-91W with Pure CSS!! by Manz
Imagining a New Level of Reality
The examples above serve as a fun reminder of what’s possible when combining great tools with creativity. As languages, frameworks, and hardware evolve, realistic animation effects become more attainable.
Just think: in the early 2000s, a similar degree of realism would have taken some pretty robust software for both developers and users. Now, it can be built and viewed without a massive investment or buggy browser plugins.
We hope these snippets inspire you to level up your web animation projects. Want to see even more? Check out our CodePen collection for additional ideas.
The post 8 CSS & JavaScript Code Snippets for Creating Realistic Animation appeared first on Speckyboy Design Magazine.
Package:
Summary:
Make MySQL database schema changes generating SQL
Groups:
Author:
Description:
This package can make MySQL database schema changes generating SQL...
Read more at https://www.phpclasses.org/package/12155-PHP-Make-MySQL-database-schema-changes-generating-SQL.html
Package:
Summary:
Create and convert document from MS Word template
Groups:
Author:
Description:
This package can create and convert documents from MS Word template...
Read more at https://www.phpclasses.org/package/12141-PHP-Create-and-convert-document-from-MS-Word-template.html#2021-07-18-16:25:09