WordPress.org

Ready to get started?Download WordPress

Forums

Include wp_list_pages() to create a Dynamic Menu (1 post)

  1. rigg4d
    Member
    Posted 6 years ago #

    Hi everyone,

    I'm trying to create a dynamic menu in my header and I keep getting "Fatal Error: Call to undefined function wp_list_pages()".

    The dynamic menu is a really nice JS menu from Peter Ned that needs exactly what wp_list_pages() outputs. So I'm trying to include a file called forTheMenu.php that is in /home/nicolasl/public_html/tutorials/wp-content/themes/default/forTheMenu.php containing the following code only:

    ##################
    <?php
    wp_list_pages('sort_column=menu_order');
    ?>
    ##################

    into my header code that is into /home/nicolasl/public_html/includes/header.php by hard coding the path (not elegant yet but to make sure it works as a test). Notice the path difference because my wordpress install dir is /home/nicolasl/public_html/tutorials/ .

    Now I always get "Fatal Error: Call to undefined function wp_list_pages()" even if forTheMenu.php is at the same place than /home/nicolasl/public_html/tutorials/wp-content/themes/default/index.php of the wordpress theme.

    forTheMenu.php doesn't have access to the function so I tried including the file that contains the function but to no avail.

    index.php does have a get_header() called before but I don't want to be stuck with having two headers so how can I do this?

    Has any one tried that somewhere else with success???

    Thanks for any help,

    niko

Topic Closed

This topic has been closed to new replies.

About this Topic