Support » Fixing WordPress » How to get a second page widget?

  • I’m retooling the default Kubrick that ships with WordPress, and I’ve been able to install an additional sidebar. I want to install a third “sidebar” for a top nav bar that has unique page navigation. Trouble is, I need an additional “Pages” widget to make this happen. I’ve located the code for the widgets in wp-includes/widgets.php, but am unsure how to make this happen. Do I need to look into creating a dropdown menu like Categories/Text/RSS widgets, or simply find a way to duplicate the widget itself? Any help would be appreciated.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Why not resort to just using the template tag, wp_list_pages(), where you want to display that navigation?

    Hello Michael. Well, I did that at first, and it works fine. However, with top navigation, too many pages means an unattractive top nav bar because your list items just begin a new line below where they should be if you get too many. With the page widget, you can exclude certain pages from showing up, and that solves that problem. But what if you had two page widgets–one for top nav and one for the sidebar, and you could exclude certain pages from both to 1). avoid the aforementioned scenario with the top nav and 2). have a unique listing of pages in both areas so the same page link doesn’t show up twice. For example, check out Unique list of pages in the top nav, and a unique list of pages in the sidebar. Way I figure it, only way to accomplish this is to have two page widgets if you also want to preserve blogging capabilities and not use categories as pseudo-page links.

    Well the widget just uses the wp_list_pages() with the exclude= parameter.

    OK, thanks. However, I should have written earlier that my real intention for doing this is to make it easy for a person on the backend to make changes to page listings in the topnav/sidebar using the Dashboard interface rather than making it necessary to modify the code. Again, having 2 configurable page widgets that can be dragged to both locations would be ideal. Is there no way to generate a dropdown menu on the widgets page that allows you to specify the number of page widgets you want?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Is there no way to generate a dropdown menu on the widgets page that allows you to specify the number of page widgets you want?

    No easy way, no. You would have to rewrite the page widget to allow multiple instances of it.

    That’s what I figured. Thanks …

    How is that parameter associated with that wp_list_pages() function if I go that route? What does that coding look like using the exclude=?

    Just read the documentation that MichaelH linked to earlier:

    Perfect, thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to get a second page widget?’ is closed to new replies.