Skip to content

Instantly share code, notes, and snippets.

@csknk
Created October 8, 2013 09:53
Show Gist options
  • Save csknk/6882353 to your computer and use it in GitHub Desktop.
Save csknk/6882353 to your computer and use it in GitHub Desktop.
Add category page title (WordPress)
/***Category Page Title****/
function add_category_page_title() {
$cat = get_category( get_query_var( 'cat' ) );/* gets the category info of the current archive page*/
$cat_name = $cat->name; /*pass the value of the category to name, and attach this to the variable*/
?><h2>Articles categorised as: <?php echo $cat_name;?></h2> /*build the headline*/
<?php
}
add_action('hook_top_category_page_title', 'add_category_page_title'); /*add function to a Thesis 2.1 hook*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment