• Resolved donnietheg

    (@donnietheg)


    Hello,

    I have been using WordPress for about 5 months, integrating it into my web development methodology, developing small sites for artists. I have come a long way, but have hit a wall. Because my web design experience is with more traditional content sites, rather than blogs it has taken me some time to shift gears. Now I am at a stage where I think I can get the best of both worlds. However, my limited experience with php is stopping me. I have searched the fourm and dos section or WP to no avail. So, I am admitting defeat and asking the community!

    Here is what I want to do::

    ::Structure my site so that there is a “main” or “intro” page post for each category with different content if it has children or not::

    Which means:
    -designate an “into” or “main” page post for each of my categories (my “home” page is static, so that is not part of the question or problem)
    -parent and children categories are permitted so both the child and parent categories would have an “into” post (i.e. they would use the same template). Note: only to 2 levels of navigation are permitted (i.e. no child of child)
    -the content of the post would be text and media (photo/video)
    Now this is where it gets even more complicated…
    -the content would also include a list of links: 1) for parent categories the links are the child categories, 2) unless the parent has no children, then the links are to the posts in the category, and 3) for the child categories the links are always the posts in that category.

    What I have tried so far:
    -I thought of using the category description as a way to create the “intro” page post. I have been able to call up the category description and place it in the post as an intro text using <?php echo category_description( $this_category->cat_ID ); ?>, but all image and other media tags are not allowed, they’re stripped off by WordPress.
    -I thought of using Pages for the “intro” pages of the categories rather than posts, but then I loose the navigation hierarchy that I want.
    -I have explored the possibility of creating an “intro” post for each of the categories always using the same title or post slug (e.g. call all the category intro pages “introduction”). Then editing archive.php using template tags and other php programming so that when we click on a category, it displays the “intro” page of that category. In other words, “if” this is a category with children, “then” display the “intro” post content and create a list of links to child category pages; “if” this is a category page that has no children, “then” display the “intro” post content and create a list of all the post titles in that category). But I just don’t have enough knowhow do this.
    -I also explored the possibility of doing the same as the previous option, but rather than using the title or post slug info to find the “intro” post, creating a rule that the “intro” post be the first one added to a new category and then use template tags and other php programming to call up the oldest post in the category. The rest follows as above..

    Anyway, I may be way off the mark and am, of course, open to any other solution. Thanks in advance for any help, it is greatly needed and appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I thought of using Pages for the “intro” pages of the categories rather than posts,
    Bad idea. You have Category_Templates in WP. Use them. That’s what they are for.

    Thread Starter donnietheg

    (@donnietheg)

    Moshu, Thanks so much for your quick reply! That looks like the ticket for distinguishing between the 3 variants:

    -the content would also include a list of links: 1) for parent categories the links are the child categories, 2) unless the parent has no children, then the links are to the posts in the category, and 3) for the child categories the links are always the posts in that category.

    I will make three templates, using copies, I’ll assign the appropriate one to the specific pages in my hierarchy using the category-x.php option. I had read about category templates when I first started using WP (when I was only understanding a fraction of what I was reading) but had totally forgotten. That’s great.

    If it is okay, I will leave the topic as unresolved until I implement the solution. There are still all the other details related to programming each of the pages that I need a little time to be sure I have a handle on…

    Thread Starter donnietheg

    (@donnietheg)

    After some work I ended up taking another attack on this problem. I posted elsewhere and resolved it. See:

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“Intro” page post for each category with different content if parent or child’ is closed to new replies.