Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Solution!
    After reading the wp docs on The Loop to explain the above discovery, I came up with this:

    the_post(); rewind_posts();

    which goes somewhere before the “global $id;” in my above-above code snippet. I don’t know how efficient this is, but it works (for now?)

    More info on the topic:
    By placing my sub-page iteration in page.php before the line:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    it breaks, but immediately following the above line, it works. Something about that line seems to set $id for me…

    jshepard- did you ever get it?
    My test wp installation works fine until I try to include subpages in the header.php template. Only slightly modified from the wp docs comments on wp_list_pages(), here is my offending code:


    <?php if (is_page()) { ?>
    <div id="subpagemenu">
    <?php
    global $id;
    wp_list_pages('child_of=' . $id . '&title_li=<h2>Sub Pages</h2>');
    ?>
    </div>
    <?php } ?>

    I get:
    Warning: Invalid argument supplied for foreach() in /mypath/wp-includes/template-functions-post.php on line 378

    Taking out that snippet for listing subpages remedies the noise.

Viewing 3 replies - 1 through 3 (of 3 total)