heyitsjeremy
Forum Replies Created
-
Forum: Plugins
In reply to: How to add menu items to the admin headerThanks! Just what I needed. 🙂
Sorry for the late response.
Forum: Plugins
In reply to: WP 2.0: Need a function sort of like single_cat_title…Ah ha! I got it. In case anyone else needs it:
Add this to you template-functions-category.php file:
function get_cat_nicename($cat_ID) {
$cat_ID = (int) $cat_ID;
$category = &get_category($cat_ID);
return $category->category_nicename;
}And then this to your template-functions-general.php file:
function single_cat_nicename($prefix = '', $display = true ) {
$cat = intval( get_query_var('cat') );
if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
$my_cat_name = get_cat_nicename($cat);
if ( !empty($my_cat_name) ) {
if ( $display )
echo $prefix.strip_tags($my_cat_name);
else
return strip_tags($my_cat_name);
}
}
}Then you can just call it via a template file:
<?php /* If this is a category archive */ if (is_category()) { single_cat_nicename(); }?>Forum: Plugins
In reply to: WP 2.0: Need a function sort of like single_cat_title…First of all, thank you so much for the help! However, when I place that in template-functions-general.php and then try to call it in my template, I get:
Fatal error: Call to a member function get_queried_object() on a non-object in C:\www\blog\wp-includes\template-functions-general.php on line 709
Any ideas? This is for WordPress 2.0.