WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display name of child category (2 posts)

  1. Evita
    Member
    Posted 7 years ago #

    Does anybody know how to display the name of the current child category as title in category and single view (outside the loop)?
    To display the current category name I use following code:
    <?php
    global $post;
    $my_cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories, $wpdb->post2cat WHERE cat_ID = category_id AND post_id = $post->ID");
    echo strip_tags($my_cat_name);
    ?>

    Thanks for any help, Evita

  2. Evita
    Member
    Posted 7 years ago #

    Found the answer myself, this Plugin can do this.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags