WordPress.org

Ready to get started?Download WordPress

Forums

Modifying PHP code in 'Header' <TITLE> (4 posts)

  1. glassshoes
    Member
    Posted 7 years ago #

    <title><?php bloginfo('name'); if ( is_home() ) { ?>» <?php bloginfo('description'); } if ( is_single() ) { ?> » Blog Archive <?php } wp_title(); ?></title>

    Above is the line code for the <title> tag on my blog. Under my Category page, only the Name field is displayed on <title> tag. how can I add the Description content in Categories field on <title> as well.

    What i meant by Description is that if you go Manage -> Categories -> you'll find content under the Description column... I'd like to display Description content on <title> tag, but don't know how to do that.

    I appreciate any advice.

  2. Kafkaesqui

    Posted 7 years ago #

    I'll avoid my natural habit of providing the cool but elaborate solution, and just point out an easy way to do this:

    <?php if( is_category() ) { echo ' &raquo; ' . category_description(); } ?>

  3. glassshoes
    Member
    Posted 7 years ago #

    works great... thanks Kafkaesqui! that was very helpful. ;)

    Question 2: i'm looking to organize my Categories sitting on the sidebar. I've set up my categories so that it has about 5 parent categories and a lot of sub ('child') categories underneath the parent categories. I'm interested in organizing the categories so that the child categories would be directly underneath the parents. I would like to display all parent categories regardless of whether it has "posts" linking to them and also display in the parent and sub categories in a 'tree' format... using the bullet points for the sub categories.

    Currently, the categories are displayed in alphabetical order with no organizational structure. I'm hoping to fix this.

  4. Kafkaesqui

    Posted 7 years ago #

    glassshoes, see the doc on the template tag you're using in your sidebar to display categories:

    http://codex.wordpress.org/Template_Tags/list_cats
    http://codex.wordpress.org/Template_Tags/wp_list_cats

    Take a look at the info on the following parameters: hide_empty, hierarchical and sort_column.

    By the way, always a good idea to start a new forum thread when moving onto a new issue.

Topic Closed

This topic has been closed to new replies.

About this Topic