The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Show only Catagories not sub catagories (7 posts)

  1. iantheripper
    Posted 6 years ago #

    I have been trying to stop the sub catagories showing on the parent catagory
    I have tried editing my archive.php to add the code
    <? if ((is_category()) && in_category($wp_query->get_queried_object_id())) { ?>

    but the log just keeps saying unexpected ;
    and i cant seem to get it to work
    the code is from this site

    and the page i am trying to remove sub catagories from is

    any ideas would be really helpfull as I am really struggling.


  2. MichaelH
    Posted 6 years ago #

  3. iantheripper
    Posted 6 years ago #

    Thanks for that idea, I tried it and it is currently running on the linked page but it doesnt seem to take effect (i suspect that the Arjuna X theme is messing it up)

    any other ideas :)

    thank you.

  4. MichaelH
    Posted 6 years ago #

    Look at the "style posts differently" in the article The Loop and use something like that in your Category Templates.

    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  5. iantheripper
    Posted 6 years ago #

    I messed up just one line of code! that is mind boggling!

    I shall try and learn what I need to do.

    I suspect I will be back :)

    thank you for your help, off to try to injest/digest/vomit ;)

  6. iantheripper
    Posted 6 years ago #

    I have read that information but it does not practically help me. thank you for the help but I need something less general.

    Does anyone know of a SIMPLE solution or sample code to help?

    thank you


  7. thelaw
    Posted 6 years ago #

    I still can't believe the URL structure is weak in WordPress.

    For various purposes I don't need to list, all I want is for the posts of every category's URL to show up as mysite.tld/category/postname/ and not mysite.tld/category/subcategory/postname/ as I don't really need it. This is especially the case if the post is part of the main category, like I have it. There should be some method of having a post keeping a primary category so that the URL structure is based off of that category.

Topic Closed

This topic has been closed to new replies.

About this Topic