Simple, reuseable WordPress pagination without a plugin

Pagination might be one of the most seen ui-patterns on the web. The concept of showing just a limited amount of articles, posts or whatever and making the reader click through the rest, comes in quite a few variations. Googles search results are coming to mind or more advanced infinite scroll solutions. Naturally, WordPress implements [...]

Read more Tweet me Plus me

Simply related posts: Add thumbnails to the related posts widget

The Snippets Story The code above is simply adding the post-thumbnail before the related post titles if it exists. Works only with my Simply related Posts plugin

Read more Tweet me Plus me

Add custom WP_Query parameters

The snippets story Some weeks ago I wanted to pass a custom parameter to the WP_Query object to change the where-query if the param was true. The problem was that the WP_Query object is already filtered when the posts_where filter is applied, so my custom parameter didn’t get through. I solved this by hooking into [...]

Read more Tweet me Plus me

Fix cropping of custom image sizes in the WordPress image editor

The snippets Story If you are using custom image sizes in your WordPress theme you likely know the problem. Cropping, rotating or flipping an image via the WordPress image editor, works just on the original. After editing the image is not available in your custom sizes anymore, all you get in your theme is the [...]

Read more Tweet me Plus me

HTML5 Navigation without a List with WordPress’ wp_nav_menu

Result: Source: Remove LI Elements From Output of wp_nav_menu The Snippets Story This is how you build a HTML5-navigation without lists in WordPress. I slightly changed the code I found on CSS-Tricks. Had to post this after todays reading of “Navigation in Lists: To Be or Not To Be” by Chris Coyier.

Read more Tweet me Plus me

Walking up the Class-Hierarchy in PHP

The snippets story Yesterday I tried to call a function for every parent class of an object and get the results in an array. I didn’t found the solution instantly, so I thought that’s something for the snippets section. The function above takes an instance of a class and a class-methods name. Then it calls [...]

Read more Tweet me Plus me

Get current/clicked nav_menu_item-id in WordPress

The snippets story I needed to retrieve the nav-menu-item connected to the currently requested page/post in WordPress. I found some solutions going through the hole menu-tree, comparing each items object-id with the current post-id. But, since menu items are post-types, you are able to use all the WP-Query-params, even a meta-query. The code above selects [...]

Read more Tweet me Plus me

Howto use array_map functionality on an associative array to change values *and* keys

First snippet for my collection.

Read more Tweet me Plus me