• Resolved elicash2

    (@elicash2)


    Didn’t see this answered at https://codex.www.ads-software.com/Category_Templates

    I’m using the Category Templates plugin so that for each Category, you can select the specific template for that Category’s archive page. Problem is, I’m not sure how to code those category templates so that they’re ONLY pulling in Posts from that Category.

    get_template_part(‘loop’,’category’) seems to work, but the problem with using it is that I can’t seem to be able to customize it for each of my templates.

    So instead I’ve tried going with something like:

    $my_query = new WP_Query('posts_per_page=50');
    while ($my_query->have_posts()) : $my_query->the_post();

    Problem with that is, it pulls in all Posts, not just the ones for whichever Category is being used.

    It’s important to note here that because we don’t know what Category will be receiving a certain template, we can’t hard-code that into it. So I can’t just say in the template code that if something “is category ‘Category A’ then do X. The template must work regardless of which Categories are assigned to use it.

    I’m not putting this in the plugin forum b/c I don’t think it’s really a plugin question… I think it’s a template question.

    Also, I’m not looking for somebody to do the work for me. If you could just help me figure out the area where I need to look into. For example, is this where Child Templates come into play? Or something else so that I don’t continue searching Google for the wrong thing.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Category pages’ is closed to new replies.