• Development

    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-672b64a7ede88065362120/] 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-672b64a7ede8f987040935/] Results are: [crayon-672b64a7ede91247260364/] So, we know that one month and…

  • Development

    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…

  • Development,  WordPress

    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-672b64a7f0141614758239/] Next step is also easy as pie. We need to compare current object ID with page…

  • WordPress

    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…

  • WordPress

    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…

  • WordPress

    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…