📜 ⬆️ ⬇️

Problem solving wp_list_pages in wordpress

Wonderful blog engine Wordpress, except for all sorts of advantages, like any other software product is not devoid of bugs. But the strength of open source software is that users themselves can make improvements and corrections. 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. The current_page_item class is also added for the currently selected page. This allows you to create beautiful effects highlighting the current page in the menu. All this works fine as long as you do not want to replace the blog on the main page with a static page (menu Settings -> Reading). In this case, the blog will be displayed on the page of your choice and the wp_list_pages ... function will stop displaying the current_page_item class for the blog menu item. In this case, all your beautiful lighting system collapses.
')
The menu can be made manually. But why then a standard function that performs all the necessary actions automatically? This bug is described on the WordPress support pages and was fixed in version 2.1. But it appeared again in version 2.1.1 and still the question remains open.

Actually the solution to this problem

Source: https://habr.com/ru/post/17355/


All Articles