1

I want to show several comics I make without having to rely on plugins (already tried them, each has some limitations I rather just do the work on my own). So I made a parent category called Comics and a child category for each comic series, Title1 and Title2 for example. Right now, going into domain/comics shows the archive as it is defined by the theme, with all the pages of Title1 and Title2 available. But going to domain/comics/title1 redirects to a single page view.

I would like to show the archive of each series in a different way the archive for blog posts, gallery images and the rest of the content of the page is shown, and creating a category-comics.php file only alters the behavior of the Comics archive and not of Series1 and Series2. How would you go about it?

EDIT: I originally phrased it not to mention I am trying to do comics to make it more applicable to other situations but was told I should say exactly what am I trying to do so I rewrote it to my specifics.

EDIT2: If anyone is wondering, Im basing my wordpress theme of the Neve theme right now. https://themeisle.com/themes/neve/

EDIT3: I have looked around and I think the piece I'm missing is how figure out the query that was made. So if the site loads archive.php, I can put a conditional clause "If category is child of Comic, load comic archive template"

  • it's a little difficult to tell with it being made deliberatley generic, but are "child 1 child 2" etc the same thing as "parent" or is this just a way of organising things? Like when people create a services page, then subpages for each service, rather than creating a service post type? I ask because there's a very good chance your category setup is not the correct solution at all, and that this problem can be avoided entirely, but it's not possible to tell without knowing what you're actually doing – Tom J Nowell Mar 30 at 10:57
  • I didn't think that would be relevant, but it is specifically for webcomcis I draw and update one page at a time, with each page on its own post. So I have a category called Comics and a child category for each series. I have been using the webcomic plugin but it has some limitations to what I want to do so that is not an option. Ill edit the main post. – metichi Mar 30 at 11:12
  • Ah interesting, did you know a page can have page breaks and internal pagination? – Tom J Nowell Mar 30 at 11:37
  • I did not know that, my plan so far was to have the single page views have navigation buttons whithin the same category (SeriesX, Gallery, News, whatever) and the archive page to show all the thumbnails in chronological order in a column to read them easily when catching up. – metichi Mar 30 at 11:49
  • Also, when you upload images they're stored as posts of type attachment with their own templates and comments and post meta etc, you could create pages that are just galleries that link to those pages as another way – Tom J Nowell Mar 30 at 12:13
0

I just found it out!

By using get_query_var ( 'cat' ) you get the value of the category in the query. So you can use cat_is_ancestor_of ( parent-cat-id, get_query_var ( 'cat' ) ) which will return true if you are looking at a child of a specific parent category. And from there you can modify your archive page to load whatever templates they need.

And regarding the issue of going to single page view, it had something to do with permalink. Setting them to "plain" made it work correctly

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.