• Resolved alexb_rj

    (@alexb_rj)


    Please, I need help!
    Could someone tell what I have to do in my sidebar, please?

    I installed a new theme and I’m still configuring it, but in the sidebar, when a page is showed – not a post – appears the following message:

    “Warning: Invalid argument supplied for foreach() in /home/bobeda/www/wp-includes/template-functions-post.php on line 368”

    I’ve tried everything to solve it, but I failed…Please, someone helpe me!

    Thanks in advance.

    Alex

Viewing 15 replies - 1 through 15 (of 16 total)
  • The blog linked from your name looks fine ?

    Thread Starter alexb_rj

    (@alexb_rj)

    No, please, see that page, in the sidebar…

    https://www.bobeda.net/?page_id=130

    https://www.bobeda.net/?page_id=130

    What should be there ?

    Thread Starter alexb_rj

    (@alexb_rj)

    Its the message: “Warning: Invalid argument supplied for foreach() in /home/bobeda/www/wp-includes/template-functions-post.php on line 368”

    I dont know how to fix nor what it means… please.

    What should be above your search box ?

    What would you normally expect to see ?

    If you have a file called ‘sidebar.php’, copy it and paste the copy at this site https://pastebin.com
    Then tell us you’ve done it ?

    Thread Starter alexb_rj

    (@alexb_rj)

    In fact, I just expect to see nothing! Its a blank space above the search box, but the message is always in this space…

    I’ve just sent you the sidebar.php

    Thanks!

    https://pastebin.com/578436

    Need a coder to see this.
    It’s something that is empty but should not be.
    Have you deleted things in the blog ?

    Thread Starter alexb_rj

    (@alexb_rj)

    Oh…

    No, I haven’t… I’m still translating this.

    But I’ve seen this theme working properly in the site where I’ve downloaded it!

    Would you like to see the “template-functions-post.php” as well?

    Would you like to see the “template-functions-post.php” as well?

    No.

    The problem is in your wp_list_pages() code. Apparently something to do with assigning $parentPageId to the ‘child_of’ param.

    Thread Starter alexb_rj

    (@alexb_rj)

    So, please, how can I fix this problem?

    I can’t tell you offhand, because I don’t know what $dlPageId refers to ($parentPageId is assigned the value of this), nor what the function get_parent_page_of() does. Neither are native to WordPress.

    Do these exist with the theme?

    Thread Starter alexb_rj

    (@alexb_rj)

    I installed this theme without change anything.

    Do you know if I can delete some part of the sidebar.php code to avoid that message?

    Find this part of your sidebar.php:

    $pageNavigation = wp_list_pages('child_of='.$parentPageId.'&sort_column=menu_order&title_li=&echo=0&depth=0');

    and try changing it to:

    $pageNavigation = wp_list_pages('sort_column=menu_order&title_li=&echo=0&depth=0');

    Thread Starter alexb_rj

    (@alexb_rj)

    yes, man, the message has disappeared! Thanks!

    But

    now there is a ‘menu’ with the pages of my blog. Is there a way to get rid of this?

    Thanks for your help!

    Thread Starter alexb_rj

    (@alexb_rj)

    Thank you all, guys. It’s ok now!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Invalid argument – foreach in the Sidebar??’ is closed to new replies.