Support » Fixing WordPress » Categories title on main page. Can it be done?

  • Hi there,
    Is there a way to show the category title on the page you are taken to when you click a category?
    For instance, when you click on say a category called ‘Points Of View’, that title is at the top of the page you were taken to in a h3 tag?
    Is that possible?
    Fiona

Viewing 8 replies - 1 through 8 (of 8 total)
  • Fiona,
    Okay, I’m gonna stick my antlers waaaay out on this one. I know how to spell PHP, and that’s about it…
    I don’t really see any reason why the category title tag can’t live on any page, as long as you maintain the rules — that is to say that you must keep it in the loop, if indeed, keeping it in the loop must be done. The Wiki has a pretty good explanation of what in the loop actually means.
    So, let’s assume that you actually can do this; you could then create a CLASS in your wp-layout.css file that would style this title, since you are likely to want it to be bigger and such, eh?
    Here’s just a made-up example:
    <pre>
    h3 .cat-title {
    background: #fff;
    font: 2.0em #3f443g ‘Lucida Console’, sans-serif;
    text-decoration: underline;
    }
    </pre>
    Then, after you have created this class, you could apply it like this:
    <pre>
    <span class=”cat-title”><template tag></span>
    </pre>
    Hope this helps, and I hope one of the community gurus will come along and explain if this is possible PHP-wise. 🙂
    Craig.

    You can use:

    <?php bloginfo('name') ?> the name of your blog
    <?php single_post_title() ?> the single post title
    <?php single_cat_title() ?> the category title
    <?php single_month_title() ?> the month title

    Outside the wp loop.. You may find more info on this in WordPress’s template docs.

    Thread Starter fionagilbert

    (@fionagilbert)

    Hi Guys,
    They worked just fine 🙂
    Now what do I do to hide the tag (below) if there are no values in the tag?
    <pre>
    <h3><?php single_cat_title() ?></h3>
    </pre>
    Is there a way to an if/then snippet in PHP?
    Thankyou all
    Fiona

    <?php single_cat_title() ?>
    … I just tried in the header, between some <sub></sub> tags … piggybacking on header class. Thanks for starting the topic, Fiona. I think I understand your reason for the if/then request, in that when there is no single_cat_title, such as on the index.php, it seems to write a blank space. But why?
    http://nommune.com

    Maybe I’m not understanding the question right, but why not just use:
    <?php wp_title(); ?>
    It’ll show the cat on the cat page and nothing on the main page. Isn’t what you wanna do?

    My reference to “empty space” was a mistake, so misunderstanding prompted by my post. I have spaces, i.e.,
    .: cat title ::::::
    around the php title call, and misinterpeted in visual results on the index, I believe. It is showing cat title on cat pages, but I thought of putting something in where the ‘nothing’ is on index.php. I’m curious now how the
    <?php wp_title(); ?>
    functions differently than
    <?php single_cat_title() ?>

    the wp_title function is used in the title tag of the index, it’s the one that shows you where you are in the bar of your browser. It shows the name of the post on single entries and year>month on monthly archives, etc…
    For the first part of the question, regarding the spaces, I still don’t really get what you’re saying. If you mean you’re using keyboard spaces to format your layout, you’re in for big troubles… 🙂 It’s probably not what you mean, but just in case… You should use CSS to format. It’s the easiest/best way. They’re countless tutorials on the net about CSS. alistapart.com would be a good place to start.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Categories title on main page. Can it be done?’ is closed to new replies.