Support » Fixing WordPress » Invalid argument – template-functions-post.php

  • Hi all, I can’t seem to resolve a particular error message I’m getting on a Links page I created (see example at http://www.onkels.org/?page_id=18).

    The error coming up is:

    Warning: Invalid argument supplied for foreach() in
    /homepages/18/d91693023/htdocs/onkels/wordpress/wp-includes/template-functions-post.php
    on line 378

    Line 378-385 reads:

    foreach($page_tree[$parent][‘children’] as $page_id) {
    $cur_page = $page_tree[$page_id];
    $title = $cur_page[‘title’];

    $css_class = ‘page_item’;
    if( $page_id == $queried_obj->ID) {
    $css_class .= ‘ current_page_item’;

    }

    For reference, this is a custom page template that I created and the error only shows up on that page. I’m running WP 1.5.2 and the Regulus theme.

    The code in my sidebar directly before the error is:

    <?php

    // —————
    // add child pages
    // —————
    if ( is_page() ) {
    global $bm_pageID;
    $bm_pages = wp_list_pages( ‘sort_column=menu_order&depth=1&title_li=&echo=0&child_of=’ . $bm_pageID );

    if ( $bm_pages <> “” ) {
    echo “<ul id=\”subpages\”>\n”;
    echo ”

  • <h2>Sub Pages</h2>
  • “;
    echo $bm_pages;
    echo “”;
    }
    }

    Many thanks,
    Dave

Viewing 1 replies (of 1 total)
  • I think I saw this error elsewhere (please do a search) and the solution was to add “(array)” at the beginning of the argument. In your case it would look like “(array)$page_tree”.

Viewing 1 replies (of 1 total)
  • The topic ‘Invalid argument – template-functions-post.php’ is closed to new replies.