WordPress
-
How to add your custom css or js on admin screen?
How to add your custom CSS or JS on admin screen? Well, it’s pretty easy. We need to hook into admin_enqueue_scripts action and this is the best and only solution. So, let’s write some code: [crayon-675b52d81a82e906453283/] Please note the $hook variable. Thanks to its value you may enqueue your scripts/styles depending on active admin screen. It is important, because you should not enqueue your scripts or styles where it isn’t necessary. Second thing, first conditional is_admin. It’s pretty obvious, but I have to mention it. Do not even hook into admin_enqueue when you are not on admin screen.
-
Get woocommerce random products
Sometimes people asks me how to get N random products from Woocommerce plugin. Well, I heard it isn’t obvious or easy. And still I don’t know why. It is more than easy! We just need to use get_posts function. Simplest function to get N random products (default value is three as you may see in the source code) would look like that: [crayon-675b52d81b5a4173550908/]
-
Symbolic links – test your themes and plugins
Symbolic links are great feature in Linux/Unix. Mac has this feature even in its GUI. Many of you knows that Windows can handle symbolic links too. But there are some people that doesn’t know about this feature or doesn’t care because they didn’t think about its power. Of course I’m not gonna to write about symbolic links just for symbolic links. We will use it in real life, for our projects. First of all, I will share one of my computers configuration with you. My first hard drive is 960GB SSD. I use it for my operating system (Windows 7 Pro), programs and local server. Server is stored in C:\server\.…
-
Hey, admin, hide your login!
I bet, that you, as a WordPress developer, knows very well that using “admin” for your administrator account isn’t very clever. Or “administrator”. Or something like that. Once I saw “root”. Even WordPress installer will let you know that. Use something different. Maybe “top-secret-user”. It is good thing, that is true. Why we should avoid that? Because attacker may discover your administrator account login and may use it (in some top secret magical way) to attack your site. It isn’t a joke, it is a possibility. So, everybody should knows that and apply this to their sites. But… There is a small trick about that… Many sites may reveal your…
-
WordPress Toolbar a.k.a. Admin Bar
First things first. Why WordPress Toolbar a.k.a. Admin Bar? Well, a lot of people knows Toolbar as Admin Bar. Still. To be honest, it was Admin Bar. It was Admin Bar in WordPress 3.2 (released July 4, 2011) and previous. Even more, for backward compatibility, WordPress class for Toolbar is named WP_Admin_Bar. However, since WordPress 3.3 (released December 12, 2011) it is Toolbar and please remember it. To be honest, I have to remember it, too. All right, to the point. WordPress Toolbar. Nice feature. Very useful. And great. And even more – it is customizable! And we will learn a few basic tricks, how to deal with it. It…
-
WordPress plugins repository
A few days ago I mentioned about my new plugins. Two of them are in the official WordPress plugins repository. So, my counter is three now. I won’t delete those plugins on github, if you use this source, don’t worry. Posts about those plugins (with github links): Post/Page specific custom CSS Queen Inspirations WordPress repository links: Post/Page specific custom CSS Queen Inspirations I also updated my good-old plugin Google Analytics Head (icon, banner and screenshot). All of my WordPress hosted plugins.
-
WordPress admin buttons once again
I just wrote small nice plugin to add custom CSS code to certain post/page. So I thought I may use it to show you my admin-like button styles (I mentioned it a few days ago – WordPress admin buttons). I’ve added static image to that post but here you are with brand new preview live! Primary Primary Darkgreen Darkgreen Forestgreen Forestgreen Green Green Lime Lime Limegreen Limegreen Seagreen Seagreen Mediumseagreen Mediumseagreen Springgreen Springgreen Mediumspringgreen Mediumspringgreen Darksalmon Darksalmon Mediumaquamarine Mediumaquamarine Coral Coral Orangered Orangered Turquoise Turquoise Lightseagreen Lightseagreen Mediumturquoise Mediumturquoise Cyan Aqua Cyan Aqua Darkcyan Darkcyan Teal Teal Darkturquoise Darkturquoise Deepskyblue Deepskyblue Sienna Sienna Steelblue Steelblue Dodgerblue Dodgerblue Cornflowerblue Cornflowerblue Royalblue…
-
Post/Page specific custom CSS
Hi, we’ve got brand new plugin for you! Post Page specific custom CSS will allow you to add cascade stylesheet to specific posts/pages. It will give you special area in the post/page edit field to attach your CSS. It will also let you decide if this CSS has to be added in multi-page/post view (like archive posts) or only in a single view. Our new plugin is available on github.
-
Do you like WordPress admin buttons?
Do you like WordPress admin buttons? Yeah, me too. And I noticed that Woocommerce has similar purple buttons. I stopped and I thought for a moment – why shouldn’t I create some other colors? Yeah, that was a good idea. My implementation needs some improvements, but I like it. You may see results over that text (yeah, I know, you know that already, it was easy Captain Obvious). Please note this is a static image file. You may also find source code on github – as SCSS source file and compiled CSS file. To use it, please add two classes to HTML element: .button and .some-button-name, like: class=”button button-darkgreen” or…
-
Google Analytics Head 1.6.0
Since new version of Google Analytics Head plugin is in WordPress repository since Nov 19, 2016, I decided to upload it also on github – you may find it here.