WordPress.org

Ready to get started?Download WordPress

Forums

Invalid argument - template-functions-post.php (2 posts)

  1. itiswarm
    Member
    Posted 8 years ago #

    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 "

  2. <h2>Sub Pages</h2>
  3. ";
    echo $bm_pages;
    echo "";
    }
    }

    Many thanks,
    Dave

  • jwurster
    Member
    Posted 8 years ago #

    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".

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags