23 responses to “How to widgetize your page menu in WordPress”

  1. Bryan

    Thanks for the info. I always find it hard to work with widgets but I am still a noob at it all anyways. I just have a problem figuring out where to put the extra lines of codes usually since I understand php enough to edit pages and such. I am sure this will help.

  2. Monday Morning Roundup - April 20, 2009 — WPCandy — WordPress Themes, Plugins, Tips, and Tricks

    [...] How to widgetize your page menu in WordPress – take even more control over your pages by widgetizing your page menu, which will allow you to add things like custom drop down menus and other widgets to your dynamic page menus. [Link] [...]

  3. Blogging and WordPress links for 4/25/2009 | Weblog Tools Collection

    [...] How to widgetize your page menu in WordPress.: Justin explains a simple method to widgetize your menu of pages on your WordPress blog. Once you do that, the page menu can be treated as any other widget. [...]

  4. iGuzz

    Does it work with 2.3 versions ? my site is still use wordpress 2.3 Thanks

  5. David

    iGuzz, you should really upgrade your Wordpress installation please see

    http://codex.wordpress.org/Upgrading_WordPress

    You are missing out on a lot of functions and security using such an old installation.

  6. anontanan

    Thank you for your sharing! It’s good for me. Bye :)

  7. Cristi

    This is exactly what I need. I’m thinking about using the NAVT plugin and this for an article sometime in the future for complete control over a WP menu. Now if Widget Logic had an graphical interface instead of conditional tags!

  8. 101 Techniques for a Powerful CMS using WordPress | Noupe

    [...] been trying to overcome this one frustrating thing with WordPress, but the method Justin Tadlock is describing here is easy and requires little coding. Your theme needs to use the wp_page_menu() function to add its [...]

  9. Blogging and WordPress links for 4/25/2009 | The Latest Headlines

    [...] How to widgetize your page menu in WordPress.: Justin explains a simple method to widgetize your menu of pages on your WordPress blog. Once you do that, the page menu can be treated as any other widget. [...]

  10. Kaspars

    Justin, could I suggest that you amend:

    'before_widget' => '<div id="page-nav">'

    to include the unique widget identifiers and classes provided by WordPress by default:

    'before_widget' => '<div id="page-nav %1$s" class="%2$s">'

    I explained the reasons why this is necessary in one of my earlier posts about best practices for WordPress themes and widgets.

  11. Monday Morning Roundup - April 20, 2009 « Internet Turnkey Websites

    [...] How to widgetize your page menu in WordPress – take even more control over your pages by widgetizing your page menu, which will allow you to add things like custom drop down menus and other widgets to your dynamic page menus. [Link] [...]

  12. baudry

    Hello
    how do you do if you have english / french website do you define this in array?

  13. Kaspars

    Justin, you are right, one cannot have two ID per tag. It probably was my widgetized part of brain thinking — “no widget can exists with proper IDs” :)

    However, I found another drawback of this method — it overwrites all wp_page_menu calls, which means that one cannot have another menu in the footer, for example, that also uses wp_page_menu.

    That said, the best solution would be to use your Widgets Reloaded plugin and turn those menu calls inside the theme files into widgetized areas.

  14. danimata

    Thank you so much for this information.
    I had to fix a WP blogsite sidebar and this was exactly what I needed.

  15. Jim Pickell

    Love the concept of this, but if the primary purpose of using WordPress and WP themes (for me) is to try to avoid coding. So, needless to say, I am not quite there. I used a theme called Lifestyle for my site. Been very pleased with what I have been able to accomplish in the last week. I am looking to add some widgetized pages that can publish specific posts and thumbnails (rather than manually entering photos/links); however, even after watching the video and reading this post (and spending a few hours yesterday editing the functions.php), I can’t quite figure out where to place the code (although I am very very close). Any guidance would be greatly appreciated. I get the sense it’s not that hard but I get an error when I post all the code. When I only post a few lines in the logical place it seems like it “half-works” (as might be expected).

  16. Roberta

    As I learn more I will always remember that I started here. Thank you for all the info I can put it to use in my business plan.Our site please check us out

  17. Knowledge Base
  18. How To Create a Dropdown Menu In WordPress | Van SEO Design

    [...] Tadlock has also written a post on wp_page_menu, including his own filter, as well as a post on developing a widget for your page menu using the wp_page_menu() [...]

  19. Jeremy

    Hi!

    I am trying to implement this method on a project right now, and I’d have question about it: if I wanna have different widgetized menus, how do I do?

    Do I simply have to call
    and
    in the code, and add different sidebars, with different names, and different functions as follows:

    'Page Menu a',
    	'id' => 'page-menu-a',
    	'before_widget' => '',
    	'after_widget' => '',
    	'before_title' => false,
    	'after_title' => false
    ) );
    
    add_filter( 'wp_page_menu', 'my_page_menu_a' );
    
    function my_page_menu_a( $menu ) {
    	dynamic_sidebar( 'page-menu-a' );
    }
    
    ?>

    Is that it?

  20. 101 Techniques for a Powerful CMS using WordPress « WPhub.biz

    [...] been trying to overcome this one frustrating thing with WordPress, but the method Justin Tadlock is describing here is easy and requires little coding. Your theme needs to use the wp_page_menu() function to add its [...]

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (e.g., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.