-
HTML Knowledge Base
I wrote few articles about WordPress, about WooCommerce, PHP etc. But where are the basics? With this entry I would like to start a new series – articles about HTML, which is not as obvious as it seems. Important: we are talking about HTML5 here. We don’t need XHTML or HTML4 anymore. And this is so good… The global structure of an HTML document Document Type Document type should be the first element passed to the browser, after headers. Browser has to know, what we are passing to it. To use HTML5 and this is the only situation we discuss here, use: <!doctype html> The HTML element As you probably…
-
Using native WordPress loading icons (spinners) in your plugins
When we create our plugin, sometimes the loading icon (or the spinner icon) can be very useful and handy. It can be used to signal the saving of settings, processing of some data or loading data by Ajax. There are many fields to use, everything is limited by your invention and your needs. I have seen many times programmers create their own “spinners” or use ready-made ones instead of using WordPress ones. Inquiry – Why use those from WordPress? For one reason – to create a consistent interface. And, in addition, to reduce the size of the plugin being created. There are many possibilities, it is worth using them. WordPress…
-
Did you forget to signal async completion?
Gulp: did you forget to signal async completion? Did you forget to signal async completion is a very common error for Gulp 4 users. Before Gulp 4, when we used Gulp 3.9.1 etc, everything works fine. We updated to version 4 and now what? Well, Gulp changed a lot and we need to update our gulp files. Let’s see one: [crayon-675b39bc76ec2918648012/] This is one task from one of my projects. It runs smoothly with Gulp 3.9.1. But when I upgraded to Gulp 4, I got this did you forget to signal async completion error while running gulpfile.js. So, what to do? We must adjust our code a little bit, like…
-
Country codes as PHP array
EN: I’m working on some client’s site and found myself in need of country names and codes written as PHP array. As finding the right list is relatively easy (maybe except polish names…) it was a bit harder to find it as PHP code. So I took Wikipedia list (it has all informations I need) and parse it to PHP array. Here is result, you may copy it for your project. PL: Pracując nad projektem dla klienta, zdałem sobie sprawę, że będę potrzebował listy państw wraz z ich kodami. Nie znalazłem takiej listy (szczególnie z polskimi nazwami), więc wziąłem listę z Wikipedii i przerobiłem na kod. Dodatkowo ten kod sobie…
-
RODO i WordPress – wydanie 4.9.6
Wczoraj ukazało się wydanie 4.9.6 WordPressa zawierające poprawki tyczące RODO (ang GDPR – General Data Protection Regulation). Polecam 🙂 Poprawka dodaje dodatkowe narzędzia w panelu administratora (menu Narzędzia/Tools). Jedno z nich pozwala wyeksportować osobiste dane, które są zapisane w systemie WordPress a drugie – usunąć je, co może dopełnić obowiązku “zapomnienia” gdyby któryś z użytkowników tego zażądał. Pamiętajcie, że RODO to nie żarty, nie chodzi nawet o samego WordPressa, ale możliwe do nałożenia kary mają górną granicę dosyć drakońską. Warto zapoznać się z rozporządzeniem i dostosować działalność firmy. Co ciekawe, Rozporządzenie Parlamentu Europejskiego i Rady (UE) 2016/679 z dnia 27 kwietnia 2016 r. w sprawie ochrony osób fizycznych w związku…
-
Enable multisite network
Yeah, I know, most of you know how to do that. But I bet that most of you need to look into documentation. Why? Because it’s not usual. So, why not describe it again… Learning by writing, that’s my point. Backup your database. I don’t even call it “first” because it must be obvious for all WordPress developers. Of course you don’t need to do that if you have fresh WordPress installation. Then enable prettylinks and see if it works. Multisite may need it. So… when obvious is done, let’s go to the process. First, we need to deactivate all your plugins. You may activate it after network is enabled…
-
Showing all errors and warnings
Sometimes, when you write PHP code, you may need to see every single error, warning or even notice. And this is a very good practice in your development environment. If you can write your code and after all tests there are not a single notice, you may think your code is ready. Of course it doesn’t mean it is good, it’s different thing. But suppressing (by handling, not by @!) all errors, warnings and notices are a very good first step. How to make PHP show all errors and warnings? It’s very easy: [crayon-675b39bc7d430736522029/] And that’s all. Oh no, one more thing. Do not enable this on production server! Every…
-
Programmatically create and login user into WordPress
Is there a way to programmatically login user into WordPress? Well, of course yes. This is, in fact, very easy. WordPress does it every time you login! Even more, we may login without using any password. WordPress basically checks password hash and if it is correct, then log user in. We may just skip password hash comparing and jump straight into login. I wrote some small plugin recently to join foreign Application with WordPress installation. User has to login into application and WP login layer has to be invisible. Here is how I did it: [crayon-675b39bc7d9ab952695411/] You may also want to know if user is already in our database. Very…
-
Your password reset link appears to be invalid. Please request a new link below.
Your password reset link appears to be invalid. Please request a new link below. Did you get stuck by that message? Yeah, me too. On WordPress.org original site. And that makes me thinking about it. They shouldn’t be wrong. So what can be wrong? Well, the solution was that easy so it was easy to skip. Forget about plugins, themes, cache stuff. If you get stuck on WordPress.org, it must be something different (well, in most cases). Ok, ok, I know. Stop writing nonsense, tell us what to do. Go into your email software or email WWW and do not click the link. Take a close look. Do you see…
-
Finally here… required PHP version
I talked about it many times, I thought about it even more. However I was stupid enough not to talk about it to WordPress team. Well, somebody did. On March 2013 as far as I remember. And finally it is here… We can mark miminal required PHP version in plugins! And maybe in themes. It wasn’t very clear, but they mentioned themes As a next step, the WordPress core team is going look into showing users a notice that they cannot install a certain plugin or theme because their install does not meet the required criteria. I won’t test it, because I don’t have any themes in WordPress repository. However,…