Category Archives: APIs

WordPress is_blog()

Instead of creating a big if statement to figure out if something is in single/archive/blog index etc just use this nice little function I found here.

Change WordPress Email From: Name

I’ve recently had the need to change the name and email address on emails which come from WordPress and at first glance it looks pretty difficult, most forum posts suggest hacking the core to make it work.

Unnecessary, just put this into your functions.php

List of Custom Post Type Categories

Its always the little things I forget and today it was how to list out categories based on a custom post type (or not, really). Really, its very simple

WordPress: Custom Category Lists

WordPress has a category list widget which you can use to show all the used categories on your blog, you can even style it via CSS to make it pretty but sometimes designers like to make it hard for you and be all ” no don’t use images, because then we need to scale them for iPhone & iPad retina display, just use a symbols font for that! ” Crazy.

So heres a categories list, just like the widget, but you can style it or change the HTML in any way you like!

$args = array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’);
$categories = get_categories($args);
foreach($categories as $category) {
echo ‘

  • ) ‘.$category->cat_name.’
  • ‘;

    via Inigo Media

    Alternative to Sessions within WordPress

    Nobody told me that WordPress total jacks up the globals making it near impossible for you to register sessions within WordPress. I tried a couple hacks to enable it via functions.php, I even went as far as ripping out code from the core to get it to work!

    In a Google search I stumbled upon the Transient API – oh lordy, yes!
    So custom sessions aren’t working for me, transients are the next best thing, they are super easy too!

    set_transient($myvar, ‘text I want to store’, 60*60*12);

    echo get_transient($myvar);


    All my troubles seem so far away!