Forums

Getting Category Titles On A Page (4 posts)

  1. laptopmemo
    Member
    Posted 2 years ago #

    What I'm trying to do (desperately) is add the name of the category on each category page. I know this improves SEO and provides a more complete feel to each page. The template used is a heavily-modified version of iBlog2.

    So simply put, for example on the "REVIEWS" page, how would I add the word REVIEWS before the main content, and is there a PHP command that can do this automatically for all category pages?

    Here is the site for you reference:

    LaptopMemo, Gadget Reviews, News & Opinion.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try adding <?php single_cat_title(); ?> where you want the category title to be displayed.

    http://codex.wordpress.org/Template_Tags/single_cat_title

  3. mozity
    Member
    Posted 2 years ago #

    I have a related question, sort of.

    I want to list the titles of posts from a certain category in the sidebar. I read the codex and thought doing some thing like this might work:

    < ?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    if ( in_category('3') ) { ? >
    <h3>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h3>

    < ?php }
    endwhile;
    else: ?>
    <p>< ?php _e('Sorry, no posts matched your criteria...yet'); ?></p>
    < ?php endif; ? >

    But I'm coming up empty. I got the cat id from the categories page under posts. have also tried getting the by the category name, but that doesn't seem to be working either.

    Thanks,
    sparkii

    P.S. I can't figure out how to type backticks so I added spaces

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    1. Post a new topic.

    2. Use the [code] button to insert backticks or simply type around your code.

Topic Closed

This topic has been closed to new replies.

About this Topic