-
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…
-
Panom i Paniom z HR pod uwagę
Czytam wiele postów w których rekruterzy doradzają programistom co mówić, czego nie mówić, jak prowadzić rozmowę. Cenna rzecz, na pewno. A już szczególnie z punktu widzenia rekrutera – co, oczywiście, pośrednio może wpłynąć i na los takiego biednego programisty. W tym zalewie informacyjnym chciałbym jednak zamieścić parę słów do rekruterów właśnie. Swoją drogą, mój słownik nie zna słowa rekruter. Zna rekieter ale czy to zabawna koincydencja czy nie, zależy zapewne od czytelnika i jego osobistych doświadczeń. Otóż, kochani, jeśli obiecujecie, że zadzwonicie o godzinie ósmej, to pamiętajcie, że ta dłuższa wskazówka sterczy w górę niczym… tutaj dla każdego coś miłego, a ta mniejsza – na bałwanku. Dzwonienie o czternastej, następnego…
-
Date and Time – PHP way – part 3
Today third and final part. Today we will talk mainly about DatePeriod class. It is very powerful tool, we can use it to iterate dates. How about iterating all Fridays? We like Fridays, because weekend starts, so… it is always good to know it’s Friday 🙂 Let’s begin… [crayon-670272e79cbc4361290265/] And results: [crayon-670272e79cbcf776983729/] I think this is self explanatory code. Please remember three things. One – I used next friday as an interval. If you use last friday you’ll get your iterator iterating downwards, so you may end in the year of -9999 🙂 Two – $item is DateTime object, you may do whatever you want as it’s normal object Three…
-
Date and Time – PHP way – part 2
Where were we? Ok., I got it 🙂 Now we gonna talk about time intervals. You know that, sometimes we need to calculate one month and a few days for example. What to do? Let’s say we start something yesterday, on 29th June 2017 and this event will continue for one month and eleven days. Don’t ask me why. So, how to calculate this period of time? We start with the code you already know: [crayon-670272e79cf1a708076129/] The result is very easy to predict. Then, let’s clone $start_date object as $end_date and add date period to $end_date object like this: [crayon-670272e79cf21241617481/] Results are: [crayon-670272e79cf24851099479/] So, we know that one month and…
-
Date and Time – PHP way – part 1
Usually, when we speak about date and time, we think about date, time or gmdate (or many other names) functions and that is all right, we’ve got them and it works. But some of you may not be aware about DateTime class, built in PHP (since version 5.2 as far as I remember). First, the constructor. It can get two parameters – time and timezone. You may omit those two parameters, then time will be set to ‘now’ and timezone will be set to null. What does it mean? It will give you current time in your default timezone (default for the server of course). You may also get current…
-
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-670272e79e536874505205/] 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…
-
Link Boundaries and WordPress events – WordPress 4.8
Today two new features. First one, link boundaries is very very clever and helpful. Have you ever added a link to your post? Of course you did. If you didn’t – then… well, you may skip this post. But i bet you did, so… how many times you need to edit this link or text nearby? Well, it might happen. And then what? Sometimes you write text and you’ve got unwanted link on it, sometimes you want to expand anchor and you got plain text… Not nice at all. With WordPress 4.8 you will see exactly link boundaries with small, non modal (of course!) pop-up. You can’t go wrong anymore…
-
Text Widget – WordPress 4.8
You may ask – what do you mean, text widget? We know text widget since… I don’t know, since big bang! Or maybe even longer! Yes, you do. And I know it, too. But this is updated text widget and it is really worth to take a look at it. Default text widget, even in WordPress 4.7.5 is very easy. It’s just a title, content and optionally you may set adding paragraphs automatically. Very easy solution and obviously outdated. So, how it looks now? Well, it’s still title and content. Automatic paragraphs option is missing… So, why it is better? Because it looks much more like text editor for posts…