[resolved] the_category() and the_excerpt() on the same line - is it possible? (4 posts)

  1. sailormarcus
    Posted 9 years ago #

    I have a problem with my blog. I'd like the category name to appear on the same line as the excerpt, i.e

    Politics. Today, Gordon Brown ...

    but I've noticed that wordpress will automatically put the_excerpt() in a paragraph (<p> </p>), so I end up with this


    Today, Gordon Brown ...

    That code is nowhere in the main index template, and I can't find it anywhere in the style.css either (that said, maybe it is there?).

    Any help would be much appreciated!

  2. sailormarcus
    Posted 9 years ago #

    Actually, I found a plug-in to deal with the "autop". (I swear, I was looking around for a long time before I posted, but it's always like that - I'm never able to find the solution by myself until after I've posted here)

    But I still have a problem - it seems the_category() doesn't do quite what I want it to - I want it to JUST display the category name, not contain a link to it. I figured I could use the single_cat_title command but apparently it doesn't work in the loop. Then I figured I could use category_description - but that doesn't work inside the loop either.

    So that leaves me with get_the_category, right? But I'm not entirely sure it can do what I want it to and I don't quite get what kind of code I should use when I want something to be displayed. Any help would be much much appreciated!

  3. Sivar
    Posted 9 years ago #

    Did you read the "get_the_category"-page you linked? The first example there is exactly what you need. *lol*

  4. flamesfans
    Posted 8 years ago #

    In case the above responses didn't help, I found the answer to a similar question here:


    By default, the function the_excerpt is wrapped with <p> tags. You can comment that out.

Topic Closed

This topic has been closed to new replies.

About this Topic