Support » Plugins » [Plugin: AutoNav Graphical Navigation and Gallery Plugin] links to siblings?

  • Resolved buskerdog

    (@buskerdog)


    I had a hard time fitting my question in the subject. Basically, this is a fantastic plugin but I’m looking to see if there’s a way to do something with it:

    Let’s say my page structure is:

    MAIN
     - ABOUT
     - BIO
     - FRIENDS

    I have thumbs for About, Bio and Friends appear at the bottom of Main, no problem. What I want is for the thumbs for About, Bio and Friends to appear on About, Bio and Friends as well, so that if you are in a child page you still have the links to the other “siblings” of the same parent.

    Is it clear? That would be awesome.

    Another thing that’s not nearly as important would be a php code that you could put in your theme rather than putting something in the posts themselves… That would be great.

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • I just found a way to SORT OF do this:

    postid=”123″ Displays images or subpages attached to the page or post with the given ID, instead of the current page or post.

    This way you can force the parent’s children thumbs in to each child. I’ll leave this thread as unresolved in case the plug-in’s author wants to chime in but this feature does solve the problem, essentially.

    Having a theme-friendly bit of php would still be sweet though…

    Good idea… I am preparing a v1.2.3 which will have optional parameters:

    [autonav display="images,siblings"]

    or as a list:

    [autonav dispaly="list,siblings"]

    This normally does not include the current page, but you can include that too:

    [autonav display="images,siblings,self"]

    As for template use, the code is in:

    http://wordpress.org/support/topic/322515

    fab, fab, fab!

    Version 1.2.3 should be downloadable here momentarily.

    Thanks! I added this to the functions.php file in my theme:

    function is_subpage() {
    	global $post;                                 // load details about this page
            if ( is_page() && $post->post_parent ) {      // test to see if the page has a parent
                   $parentID = $post->post_parent;        // the ID of the parent is this
                   return $parentID;                      // return the ID
            } else {                                      // there is no parent so...
                   return false;                          // ...the answer to the question is false
            };
    };

    to get the is_subpage() conditional tag

    And then put this in my page.php

    <?php if ( is_subpage() ): ?><?php print autonav_wl_shortcode(array('display'=>'images,siblings,self','pics_only'=>'1')); ?>
    	<?php else : ?><?php print autonav_wl_shortcode(array('display'=>'images','pics_only'=>'1')); ?>
    	<?php endif ; ?>

    Works so far!

    oops, spoke too soon. On pages with no subpages I get this error:
    Warning: Invalid argument supplied for foreach() in /home/xxxx/public_html/wp/wp-content/plugins/autonav/autonav-wl.php on line 479

    Alright this uses get_children to check if the page has any children before running the autonav on it:

    <?php if ( is_subpage() ): ?><?php print autonav_wl_shortcode(array('display'=>'images,siblings,self','pics_only'=>'1')); ?>
    	<?php else : ?><?php if ( get_children( $post->ID ) ) : ?><?php print autonav_wl_shortcode(array('display'=>'images','pics_only'=>'1')); ?><?php endif ; ?>
    	<?php endif ; ?>

    Version 1.2.4 resolves the above case (buskerdog, you should be able to remove the extra php), and indeed the general case where no output is produced.

    buskerdog — If you agree this completes your suggestion, please mark this thread Resolved, and many thanks!

    Indeed! Great work!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: AutoNav Graphical Navigation and Gallery Plugin] links to siblings?’ is closed to new replies.