Show Only Category (Not Subcategory) Content

Show Only Category (Not Subcategory) Content

If you ever wanted to only show the content of the category you were on in the category view of WordPress (instead of the category you are on plus all of it’s subcategories – you can easily do so by adding the code below to the template that is used to show your category content

You would start your loop with this:

 

Put your title, content functions here

and where you normally see the call, put to close the additional (in_category) if statement.

This code gets the current category and then only displays categories that are in that category (not sub category)

11 thoughts on “Show Only Category (Not Subcategory) Content”
  1. Larry |

    i tried your code!

    and it doesn’t work!

  2. jzelazny |

    Send over your code so I can see it and help you.

  3. Amanda Gillespie |

    Thankyouthankyouthankyou! This totally works and was EXACTLY what I needed! Thanks so much.

  4. jzelazny |

    I am glad I could help!

  5. michael |

    Is there anyway to get this to work on the homepage?

  6. Tobi |

    Perfect! Thank you!

  7. Steef |

    PERFECT with triple !!!!

    it works great was looking for it for hours you made my day

  8. jzelazny |

    Glad I could help!

  9. Dennis O'Neil |

    Thanks so much. This is EXACTLY what I needed.

  10. dave |

    How can i implement these codes,,can you show the whole code

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.