• Resolved melissasue

    (@melissasue)


    I’m trying to create unique category pages and on these pages, I would like to use at least multiple loops to display two different types of category listings (I’ve tried other methods, and now this one isn’t working, I might cry) I’d actually like to shoot for three loops, but if I can only get two I could deal with it.

    That being said, this code below produces a blank page, so I’d like to get an idea where I’m going wrong.

    <?php get_header(); ?>
    <h2>New Releases</h2>
     <?php query_posts(array('category__and' => array(8,387)));?>
         <?php if (have_posts()) : ?>
                   <?php while (have_posts()) : the_post(); ?>
        <li><a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>
              </a>  </li>
         <?php endwhile; ?>
    <h2>Backlist</h2>
    <?php $my_query = new WP_Query(array('category__and' => array(8,387))); ?>
    
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
        <li><a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>
              </a>  </li>
      <?php endwhile; endif; ?>
    <?php get_footer(); ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • it seems that your file is not getting ‘called’, because even if your querys would be wrong (which they are not) at least the headlines would be shown.

    where and how do you use this file?

    is it supposed to be a page template?
    (i don’t see the template declaration and name at the beginning of your code)
    https://codex.www.ads-software.com/Pages#Page_Templates

    or, is it saved as archive.php or category.php or any of the fixed wordpress template file names?
    (see template hierarchy https://codex.www.ads-software.com/Template_Hierarchy )

    and – i believe it asked this before – do you really have posts that have these two category ids ?

    Thread Starter melissasue

    (@melissasue)

    As I answered before, yes. I really do have posts in these two categories. I know that because I had to add the posts to these categories for the purposes of calling posts with these categories in common.

    I’m using it as a category template page, and I just started by copying the category page that was in the theme. It’s saved as category-8.php so that when you click on the Alexander, Victoria category (which is id number 8) this will come up.

    and what does it show, apart from header and footer?

    does it show the ‘New Releases’ and ‘Backlist’ titles?

    what if you save the same file as ‘category-387.php’ ?

    Thread Starter melissasue

    (@melissasue)

    It produces a blank page.

    In fact, this is the link:
    https://www.romancefan.org/category/authors/a-e/alexander-victoria/

    Thread Starter melissasue

    (@melissasue)

    And saving the same file as category-387.php also produces a blank page.

    just a few random questions:

    if 8 is the category is for ‘alexander-victoria’

    what is the category name of cat 387 ?

    what is, in plain words, the purpose of this special category template?

    what would a <?php query_posts('cat=8,387');?> do different?

    do you have any plugins installed?
    if so, then deactivate all of them.
    if the problem stops, activate one plugin at a time and see if the problem reoccurs.

    Thread Starter melissasue

    (@melissasue)

    It looks like All in One SEO Pack was making this difficult. I’ve deactivated it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Attempt To Use Multiple Loop Produces Blank Page’ is closed to new replies.