WordPress.org

Ready to get started?Download WordPress

Forums

Show only Catagories not sub catagories (7 posts)

  1. iantheripper
    Member
    Posted 4 years ago #

    Hi,
    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
    lonewolf

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

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

    Ian

  2. MichaelH
    Member
    Posted 4 years ago #

  3. iantheripper
    Member
    Posted 4 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
    Member
    Posted 4 years ago #

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

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  5. iantheripper
    Member
    Posted 4 years ago #

    OMG
    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
    Member
    Posted 4 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

    Ian

  7. thelaw
    Member
    Posted 4 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