Archive for the ‘Wordpress’ Category

WordPress: Get template variables (post id, category id)

Monday, September 7th, 2009

Get current category

<?php $current_category = single_cat_title("", false); ?>

Source: – single_cat_title

Get current post in a loop

<?php $current_post = get_the_ID() ?>

Source: – getId

WordPress: PHP is user logged in > is_user_logged_in()

Saturday, March 21st, 2009

if ( is_user_logged_in() ) {echo ‘WordPress says you’re logged in!';}
else if ( !is_user_logged_in() ) {echo ‘WordPress says you’re not logged in!';}

Particularly useful to avoid adding Google Analytic code when the user is logged-in. For example, if you are editing you blog from different access point, the Google Analytic filters can become cumbersome to manage.

WordPress: Stop Replacing Double Dash with Em-dash

Friday, January 16th, 2009

WordPress automatically replace ‘--‘ by ‘–‘.

2 Options:

    1) use <code>


    2) Edit SITE_ROOT/wp-includes/formatting.php

    and change the $static_characters and $dynamic_replacements
    This is quite risky and not really good for maintenance.

WordPress: Testing Themes (works with WordPress 2.6.2)

Thursday, October 2nd, 2008

MUST have plugin to test WordPress themes: Theme Test Drive

Thanks Vladimir for this great plugin.