WordPress
-
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…
-
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…
-
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-67025ec622488767135767/] 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,…
-
How to style widget description in admin menu?
Is it ever possible to style widget description in admin menu? Well, the short answer should be no, however longer answer should be yes, of course. You must keep in mind, that this method is a bit tricky. If you may avoid that, please do. If you have to style your widget description using html, well… this article is just for you. I found myself dumbfound when I realized I need to style widget description but… it’s impossible using normal WordPress actions, filter or hooks. WordPress is using wp_sidebar_description function to show widget description in admin panel and it is located in \wp-includes\widgets.php. When you take a look into source,…
-
WordPress: How to localize your JavaScript code?
Update (on 17th July 2017) – see the bottom of the page. In WordPress, while writing theme or plugin, you should always keep in mind localization. Maybe your theme or plugin become so popular and someone would like to translate it into another language? It’s easy for me to think about localization, because I write my themes and plugins using english language and I usually add polish translation, because I’m Pole. So it isn’t very hard to achieve. Localization in WordPress is very easy. Let’s see one example from my plugin, Google Analytics Head. Plugins requires some information in the file header, like plugin name, description, author etc. There is…
-
Add meta boxes on Front Page only without template
I am rewriting one of my old pages into WordPress theme and I needed some meta boxes. But for front page only. I don’t need them to be show on any other page. It isn’t very hard to do, you just need to check template meta. But I don’t want to use template. I got front-page.php file to view front page and that’s it, I don’t need specialized template. So, what to do? It’s pretty easy. First, we need to hook into meta-box action. It’s simple and well known, but… Here’s the code: [crayon-67025ec636922440651236/] Next step is also easy as pie. We need to compare current object ID with page…
-
Multisite – WordPress 4.8
What? Multisite? Of course I mean changes to multisite networking. First thing first. The goal is to remove is_super_admin function. We still have it and it isn’t deprecated yet. Even more, WordPress 4.8 still uses this function. But still (third time!) it is planned, so we need something in spare. WordPress 4.8 bring us two new capabilities: setup_network – if your site is single instance, this capability is mapped to manage_options and if you run multisite it is mapped to manage_network_options, upgrade_network – this one isn’t mapped, it is granted for network administrators. Besides new capabilities, we have four new hooks related to multisite. Those are: minimum_site_name_length – this one…