Using the Post Type description in WordPress Themes

Sometimes, especially in the case of an items list, apart from the header/title of the list, we would want to add some text as an introduction for these items: a global suggestion, perhaps a couple of interesting links, a descriptive or in detail approach about the items, a definition, etc. When the items to list are inside a Category or a Tag, to add a header with description is obvious because, simply taking a look to the screen for editing terms, all of us know that they have a description but, do you know that post types have also got a description, and that you can use it in your themes?

An example of using the Post Type description in WordPress Themes

Yes, in the same way that with the terms of a taxonomy, WordPress Post Types have also got a field to add a description thus, you can use this property of the Post Type object to introduce any text that you want and Continue reading…

Checkbox fields in WordPress Metaboxes a solution for NULL values

Talking about forms, one of the most common issues is that checkbox fields don’t return any value when they are not checked. We just receive their values -usually TRUE- when they are checked but if they are unchecked they ‘say’ nothing. What can we do?

Checkbox fields in WordPress Metaboxes a solution for NULL values

This behavior of checkboxes fields is not an error, long time ago they was designed in that way (they are silent) however, in most cases,  this behaviour is a problem because the lacking of value doesn’t allow developers to know whether there is not actually a value, or if the value is actually FALSE. There is not difference between NOTHING and FALSE so Continue reading…

How to add a Metabox. A step by step approach. add_meta_box

The WordPress posts edit Tool is not an unique compact module that shows all the boxes that appear on the screen but it’s a set of different little modules –called metaboxes– working together. A little module controls the title, another one controls the visual editor, another one defines the publishing options and actions, another one is for the Post Format… the Categories, the Author’s post, etc. The reason of this modular design is to allow developers to introduce easily new boxes (or remove some ones) in the Edit Screen.

The Edit Screen of Posts and its different Metaboxes

So thanks to this modular design, we can create our metaboxes for adding new functionalities or data to the WordPress Posts Continue reading…

How to show all post types in Front Page results

Every day more websites use the Post Types extension of WordPress. They are not publishing just (simple) posts but they publish recipes, people profiles, city reviews, testimonials, or whatever you could imagine. It’s fantastic to be able to works easily with all these kinks of different information both in Front End and Back End however, when you access to your Front Page these Post Types aren’t shown in the results list of the main query. Are they shy? What can we do?

Army Photography Contest - 2007 - FMWRC - Arts and Crafts - A Plumpish Proportion

This behaviour is because of the relationship between the kind of executed WP query and the URL that you are typing in your browser. When you register a new Post Type inside your themes or plugins, WordPress automatically creates a new Continue reading…

Social Menus with Genericons

As a tiny module that follows WordPress very closely –it was included in the Twenty Fifteen Theme for example–, but not as a part of the official WP core, Genericons is an icon font very useful if you are thinking in creating a Social Menu. Well, this font includes a lot of good icons for other tasks but a third part of its icons are designed for giving support to social extensions.

Social Menus with Genericons

Using Genericons, to create a social menu for example similar as the installed in this web site, it is so simple as enqueueing the Genericons Font, creating a new WP menu and deciding which social profiles you desire to include. You don’t need to add a special code, or modify substantially your themes Continue reading…

Constructing WP themes or plugins that take into account future gender translations

Actually, there is not a simple solution for avoid the gender issue if you are translating a WP theme or plugin to languages that take into account the gender for selecting the words of a sentence. Simple, try to substitute the gendered words or expression for others that feet into the sentence without too many problems… But if you are not translating but creating a new theme or plugin you can use a simple set of techniques –better maybe suggestions–, that will allow future translators for dealing to this kind of problems with better results. Let’s go to see three simple proposals.

Rest area

But, before to go to the solution, let me show you a tiny example of this kind of gender issues. Continue reading…

Changing the user’s Contact Info fields

By default, WordPress still maintains very old contact info fields for users so the most probable is that you want to improve them and, on the other hand, despite of some themes or plugins have already made this change, probably you don’t want either that these improvements depend on one installed theme or plugin but rather they always keep available.

Improving User’s Contact Info

So, in this example, we’re going to develope a simple plugin that makes three different things Continue reading…

Using wp_add_inline_script function. A Google Analytics example.

Until version version 4.4, in WordPress, there was only one way to add script files to the WordPress themes, the function wp_enqueue_script however, the new version 4.5 has introduced a new way, the function wp_add_inline_script that allows us to add javascript text scripts directly inside a template and that, in addition, it can be directly connected with other scripts. Let’s go to see how it works.

Example of using the wp_add_inline_script function

At bottom, this new function wp_add_inline_script is the equivalent for scripts files, to the wp_add_inline_script function is for CSS files. Let’s see how it works through and example based on adding the Google Analytics script to a WP theme. Continue reading…

Configuring WordPress Automatic Background Updates

Automatic background WordPress updates were introduced in versión 3.7 and since then, this module has been maintaining your installation updated and ready for working however in some cases, you don’t desire that your WordPress installation changes without your permission. Perhaps for compatibility with a special developement addition, perhaps for some non updated but critical plugin or any other reason you do need to control manually the WordPress Updates. If this is your case then go ahead but rather it is much better to leave the maintenance module quiet.

Configuring WordPress Automatic Background Updates

As the official documentation explains about the Automatic Background Update Module, this module has 4 different Types of working. Continue reading…