Solving wp_list_pages in Wordpress

    A wonderful engine for Wordpress blogs, in addition to all sorts of advantages, like any other software product, it is not without bugs. But the power of open source software is that users themselves can make improvements and fixes. The removal of the glitch with the output of the site menu using the wp_list_pages () function will be discussed.

    Problem

    When listing pages, the wp_list_pages function adds the page_item class. For the currently selected page, the current_page_item class is also added. This allows you to create beautiful highlighting effects for the current page in the menu. All this works fine until you want to replace the blog on the main page with a static page (Settings -> Read menu). In this case, the blog will be displayed on the page of your choice and the wp_list_pages ... function stops issuing the current_page_item class for the menu item "blog". At the same time, your entire beautiful backlight system collapses.

    Menus can also be made manually. But why, then, a standard function that performs all the necessary actions automatically? This bug is described on the WordPress tech support pages and was fixed in version 2.1. But it reappeared in version 2.1.1 and so far the question remains open.

    Actually the solution to this problem

    Also popular now: