• Hello,

    First of all, great module (Dynamic Subpages) saved me a lot of headache! Thank you.

    I have a small issue:
    I have a page called “Information”, which has a child page called “Blog”. Through the wp-admin Settings > Reading page I set my “Posts page” to “Blog” which is a child of Information page. I have also set up a new menu from wp-admin Appearance > Menus and only added my top level pages there.

    Now when I go to the “Blog” page it doesn’t show the submenu. All the other pages work perfectly. I dropped my custom widget area created for this plugin in the header.php template page so the widget area is there (I inspected the HTML too, the widget area is there but it’s empty).

    It seems like something’s not being set on the “posts” archive page when it’s set to a custom page through the wp-admin settings. Is this a known bug and is there a fix for this somewhere on the net?

    I am going to try and solve this myself and will post if I come up with a solution. But in the meantime if anyone has a solution it would be greatly appreciated.

    Thanks.
    Baysaa.

    http://wordpress.org/extend/plugins/dynamic-subpages/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter baysaa

    (@baysaa)

    Well I guess I should’ve looked at the code first before posting here.

    After I posted my original post, I went to look at the code and I found the bug quite quickly. The problem was that when you’re on a posts archive page global $post; was not returning that page’s id, but instead returning the id of the first post on that page. The solution was very simple, just get the id of the page manually. Thanks to http://www.blog.highub.com/cms/wordpress/wordpress-front-page-posts-page-id/ I was able to manually get the page id of posts archive.

    So here’s the fix: (Note: not tested on custom post types archive pages)

    File:
    wp-content/plugins/dynamic-subpages/dynamic-subpages.php

    Find:
    Should be line 57 on version 1.7.2 of the plugin
    global $post;

    Replace with:

    // if blog 'posts' page get $post manually
    	// otherwise use global $post var
    	if(is_home()){
    		$post = get_post(get_option('page_for_posts'));
    	}else{
    		global $post;
    	}

    Baysaa.

    ladygeekgeek

    (@ladygeekgeek)

    Hi baysaa,
    Thanks a million for this.

    I’ve managed to get the sub menu showing on the post archive page, but it doesn’t show up on the individual posts. Any ideas how I can do this?
    Many thanks,

    Charlie

    Thread Starter baysaa

    (@baysaa)

    It’s quite simple, if you’re using the default “post” type then simply replace the following line:

    if(is_home()){

    with:

    if(is_home() || 'post' == get_post_type()){

    For more conditions check this page.

    ladygeekgeek

    (@ladygeekgeek)

    Thanks for getting back to me Baysas. I’ve changed it to this

    if(is_home() || 'post' == get_post_type()){
    		$post = get_post(get_option('page_for_posts'));
    	}else{
    		global $post;
    	}
    
          $this_page_id=$post->ID;

    But it sub-menu still isn’t showing up on individual posts . Not sure what I’ve down wrong….thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Dynamic Supages] Menu not appearing’ is closed to new replies.