Pagination is always an issue…

Echoing a paginatorĀ in an WP_Query instance can lead us to the madness. Sometimes, one just need to echo a paginator for a specific post type, and for some reason the pagination doesn’t fully works.

This gist is a complete solution for your problems. It’s purpose is to be used as a template tag, under the default WP_Query or a custom instance. It’s using paginate_links function and you are allowed to pass parameters to that function too.

Enjoy!

How to change the admin menu Post labels

Change Posts to News

Imagine your client don’t like the term Posts and, since he’s going to use that area to write some news he askes you to change Posts to News. It happen to me a lot of time. You will find below a way to change labels in admin menu.

 

 

 

How to implode an array with key and value

I’ve been searching for primitive functions and method in PHP and sometimes I reach the goal of having a particular function that fits the purpose. Well, it happens to me a lot of time.

Take implode function as an example. It’s purpose is to implode into a string an array of values, but, what about the keys? There is no option neither to include them while imploding, but even if it could be possible the question remains: what is the best algorithm to implode an array of keys and values pairs?

Last time I needed to create a string of HTML attributes programmatically and then I started to create a draft of a function that, taking an array of keys and values pairs, could output “my desires”. The function below implodes an array and includes the key and value pair, given a $glue and a $separator.

You can, for example, encode an array to be sent as an URL query using this function or if you want to output an HTML element attributes like this:

Have fun!

First: Me and WordPress

First of all, I lost all my previous posts during this migration to my new webserver. Althought I backup all websites in a daily basis, I didn’t backed up my blog. That’s why we should keep up-to-date backups instead of having the trouble of searching the WebArchive machine.

I will start this new blog by saying that I am negatively impressed with my presence in the internet about WordPress. Almost everything I do these days lays down under WordPress profile and GitHub, that made me think about the need to have a dev log where to include and share my own stuff. And here it is!

I work with WordPress since version 1.5. I remember everything about it and how I discovered it and how impressed I was about its extensibility.

You can find my work here (I will be updating this blog more often) and that’s it.