WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Stripping the_content() - but only one category (6 posts)

  1. Thord Daniel Hedengren
    Member
    Posted 7 years ago #

    I found this little piece of code in the Codex to strip the_content(); from, well, everything but the title.

    <?php
    if ($single) {
    the_content();
    }
    else {//no content, nothing.
    }
    `?>

    Is there a way to apply this to only one category, and have the others listed as usual?

    Thanks!

  2. Chris_K
    Member
    Posted 7 years ago #

    Sure. use the is_category() tag. http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    For an example, look at this section: http://codex.wordpress.org/the_loop#Style_Posts_From_Some_Category_Differently

    It could easily be modified to do what you want as well.

  3. Joshua Sigar
    Member
    Posted 7 years ago #

  4. Chris_K
    Member
    Posted 7 years ago #

    doh. yeah, what alphaoide said. I pointed to is_category instead of in_category. At least my linked example gets it right. :-)

  5. Thord Daniel Hedengren
    Member
    Posted 7 years ago #

    Thanks! I'll take a look at it! :)

  6. Thord Daniel Hedengren
    Member
    Posted 7 years ago #

    Sweet, I think I've gotten everything to work the way I wanted (technically, heh). Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic