WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_list_pages tag broken in WP 2.8.6?? (12 posts)

  1. dickkirkland
    Member
    Posted 4 years ago #

    Hi all,

    I was wondering if anyone new if the use of wp_list_pages along with its various parameters is broken in 2.8.6.

    I've been reading a lot about it today, but not a lot of definitive answers on whether this is a true bug or not.
    Mainly, because I can't find a scenario being written about that's close to mine.

    Mine is very simple really.
    I use the following to include only certain pages for a nav at the top of my site.

  2. /" >Home
  3. <?php wp_list_pages('sort_column=menu_order&hierarchical=0&include=2&title_li='); ?>

    The first list item displays "home" which is not an actual page.
    The wp_list_pages expression includes an "about" page next to "home".

    I've altered the "include=x" paramter many times to include certain pages to see if it works. I've also checked the page order field to make sure all pages have a page order number to work with.

    Funny thing is, the numeral entered into the "include=x" argument does not always produce accurate results. Sometimes, another page shows up that is not even near the same page order number as assigned when creating the page.

    Most of the examples with wp_list_pages have to do with troubleshooting of child trees, parents, etc.

    I'm using the most simple presentation of the tag and have followed the codex on the subject closely and carefully.

    Is there another area outside of my header.php file that could be causing the wp_list_pages not to display properly?

    Any help or advice on this issue would be greatly appreciated.

    Thanks in advance.
    Sincerely,
    Dick

  • MichaelH
    Member
    Posted 4 years ago #

    No it's not broken as far as I know. The menu order is set when you create a Page in the Attributes module under the Order field.

    The Home is not a real page but seems to be 'hardcoded' in your header.php.

    If necessary, deactivate all plugins to make sure one is not conflicting.

    You can also change to the WordPress Default theme, and put your wp_list_pages code in place of the wp_list_pages code that resides in the Default theme's wp-content/themes/default/sidebar.php file and see how Pages are displayed.

  • dickkirkland
    Member
    Posted 4 years ago #

    Thanks for the suggestions.
    I will try them and repost.
    Dick

  • dickkirkland
    Member
    Posted 4 years ago #

    Hey MichaelH,

    I deactivated all plugins, saw no change in the usage of wp_list_pages in my current theme, then changes themes and still do not see proper results for the wp_list_pages example above.

    Do you have any other suggestions or ideas as to what's going on?

    Thanks in advance.

    Sincerely,
    Dick

  • MichaelH
    Member
    Posted 4 years ago #

    Please paste all the code from the theme template file (probably header.php) that is displaying the wp_list_pages into a pastebin such as wordpress.pastebin.ca, and report the link back here. Maybe someone can spot your problem. Thanks.

  • dickkirkland
    Member
    Posted 4 years ago #

    Hey again,

    I've done as you asked and copied the file to wordpress.pastebin.ca so that all can see it.

    http://wordpress.pastebin.ca/1673998

    I would post a visual, but the site is in development behind a firewall on a server that the internets don't know about.

    If anyone can help or offer insight to this issue, I would greatly appreciate it.

    Thanks,
    Dick

  • MichaelH
    Member
    Posted 4 years ago #

    This line of code creates the 'Home' link:

    <li><a href="<?php echo get_settings('home'); ?>/" >Home</a></li>

    Sorry, I have no problems using your wp_list_pages code. Don't have any ideas.

    In fact, when I add Order to pages, those pages adhere to that order when shown in the Edit Pages screen in the Admin.

    Maybe someone else will have something to add to the thread.

  • dickkirkland
    Member
    Posted 4 years ago #

    Thanks again MichaelH,

    I was wondering about one more process that may be causing the wp_list_pages calls to be out of order.

    Do you know if calling wp_list_pages in the header.php as well as in the sidebar.php can cause the tag to not display content (pages) correctly.

    I was thinking that if there was confusion for the calls here, the results may be as they are now, unpredictable.

    Is there any strict rule about the usage of wp_list_pages in two areas within the same page or post?

    My reason for the wp_list_pages calls to be in both places are that some pages, like "about" and "contact us" may only need to be linkable from a top nav, whereas the rest of the pages are being associated with larger content pieces.

    Please let me know what you think when you have a moment.

    I haven't had time to test this theory yet, as I'm not at my (work)station right now.

    Thanks again,
    Dick

  • MichaelH
    Member
    Posted 4 years ago #

    Having duplicate wp_list_pages should not cause problems. I had two versions both in the sidebar.php with no problem. And again the order works in the Admin Edit Pages screen.

  • dickkirkland
    Member
    Posted 4 years ago #

    Hi again,

    I was reading that the duplicate calls are causing several others to have problems. I'd certainly like to have your results and will try them again tomorrow AM EST.
    Alternatively, what would be the best way to navigate to pages other than using the wp_list_pages tag, if I can't get both instaces of the tag to work?
    I assume it would be something similar to the "home" function but rather have a relative link to the page(s) in question?

    Sorry to bug you again with more questions.
    Thanks,
    Dick

  • MichaelH
    Member
    Posted 4 years ago #

    Well there's the template tag, wp_page_menu() or get_pages.

  • dickkirkland
    Member
    Posted 4 years ago #

    Turns out I thought I was using "page order" numerals in the argument 'include=x,y,z'.

    After reviewing my code for about the 100th time, I figured out that the numbers being referenced in this argument are actually for page "id"s and have nothing to do with page order numbers as designated in the WP UI on a "create page" segment.

    Geeezzz!
    Thanks for all of your efforts though.
    Live and learn,
    by the Codex!
    Dick

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags