Themes

Category Archives — Themes

Articles about the themes I worked or I’m working on, and how to break and extend them.

Quick Tip: How to Disable Page Templates in Child Themes

While developing a website with WordPress, you’ve probably been or will be in the following situation:

You created a Child Theme, inheriting a number of page templates from the parent theme. The thing is, maybe you don’t want some of those page templates. You don’t want your users to select it, or you’re not gonna support it, or it’s not fully compatible with the modifications you’ve made, or you just simply don’t like it. Whatever the reason is, you’d like to remove it from the dropdown in the page editor when creating a new page.

Before WordPress 3.9, there were some bizarre and pretty much complicated things to accomplish this. However, wlth the introduction of the theme_page_templates filter, it has become a really easy task to do.

Read more

How to Avoid Redeclaring Inline Styles for WordPress Customizer

My first publicly released theme, Follet (the one that powers this site right now), features my also first experiments working with the Customizer. This API offers a great way to see modifications to a theme in real time without actually having to apply those changes to the live site, and a large number of articles have been written about its benefits. What I learned while working on Follet was that sometimes is pretty difficult to manage some styling modifications for the customizable areas of the theme, and I particularly had a really nasty time with colours. However, I think I finally could solve that in an acceptably elegant way.

Read more

Correctly Obtain the Path to the WordPress Admin Directory

WordPress comes with a lot of handy tools that let you have URLs and paths to some folders without having to hardcode them, such as the content_url() and get_stylesheet_directory() functions for the URL to your content folder and the absolute path to your current theme folder, repectively. You can see a list of all these functions in the Codex.

However, if we search for some function to retrieve the absolute path of the admin folder, we’re lost. We have admin_url(), get_admin_url(), network_admin_url() and get_network_admin_url() but those only gives us URLs, not paths. Our only answer is to create our own function.

Here’s How You Do It

Of course you can use something like ABSPATH . '/wp-admin', but that doesn’t offer any guarantees in case the admin folder were to be renamed at some point, let’s say manually, by a plugin, or with some rewrite rule. There’s a lot of ways thing can go wrong using that method, especially if you’re distributing your code.

What I suggest as a more proper solution is to create a function like this inside your plugin or theme:

What we’re doing here is replacing the base URL of our site with the ABSPATH constant, which contains the full path to the root folder of your WordPress installation, thus leaving the /wp-admin part (or whatever it’s called) intact. We obtain the name of the admin folder dynamically, without the need to hardcode it at any point.

You can also get the path for the network admin by just replacing the call to get_admin_url() with get_network_admin_url().

Hope this helps 🙂

Read more

Follet Is Now Available Through the WordPress Themes Directory

Well, the wait was worth it, and finally Follet can be downloaded from the WordPress Themes Directory. The guys in the Theme Review team do an awesome job by giving advice on how to improve your theme, which is very useful not only for the directory, but to improve the overall quality of your work too.

Downloads are doing pretty good, and some people gave me very positive feedback about the theme. I’m very glad and thankful for all of that, so I hope to start seeing Follet installed in some websites soon. Right now I’m looking forward to version 1.1, which will correct some glitches and present some new useful features. Also, pretty soon there will be some little tutorials on how to take advantage of all the hidden functionalities that Follet has built-in.

If you already tried Follet, thank you 🙂 And in case you don’t know what I’m talking about, you can download Follet from the theme directory here, or see the demo site here.

Read more

The Follet Theme Was Sent for Revision

I’m pretty excited to tell you all that my latest project, Follet, was sent for revision to the WordPress Theme Directory yesterday. I’m really looking forward to have it featured there, since it took me a couple of months of hard work, trying to follow all the best practices I could and all the guidelines from the Theme Review team. I also had to make a lot of decisions about features being there, not being there, or being hidden. The design process took a significant amount of time too, in my attempts to make it look modern, clean and customizable at the same time.

It will sure take some more work, based on the corrections and suggestions from the guys in the Theme Review team, but I’m willing to do that too. I’m sure I will learn a lot from this 🙂

So, I will be posting here again when/if Follet gets approved. In the meantime, you can check its demo, or take a look at the code and star it in Github.

Read more