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

September 7th, 2009 by jeremychone

Get current category

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

Source: codex.wordpress.org - single_cat_title

Get current post in a loop

<?php $current_post = get_the_ID() ?>

Source: codex.wordpress.org - getId

Leave a Reply