Hierarchical Pages 1.6.1

    December 13th, 2013 by bill

    Just in time for WordPress 3.8, an updated of the popular Hierarchical Pages plugin, with over 26,000 downloads since 2009.

    • Correctly terminates the <div> around categories lists
    • Includes Spanish translation provided by Andrew Kurtis of WebHostingHub.com
    • If the only page to be listed is the current page, the widget output is completely suppressed

    See the Official release version on WordPress.Org and watch the development version on GitHub.

    Displaying a read more link after excerpt, with Autonav

    January 27th, 2013 by bill

    Here is an example AutoNav filter that will display a “Read More” link, for posts in a list.

    We invoke this as follows:

    [autonav display="posts,list,title,nothumb,excerpt" count=5 postid="category:autonav-plugin" class="readmore"]

    Live demo form the posts on this site:

    Put this code in your theme’s functions.php:

    function autonav_excerpt_readmore($html, $class, $pic, $attr) {
      if ($attr['display'] == 'posts' && $attr['class'] == 'readmore') {
        if (strlen($pic['excerpt'])) {
          $html .= '<a href="' . $pic['permalink'] . '">' . __('Read more') . '...</a>';
      return $html;
    add_filter('autonav_create_list_item', 'autonav_excerpt_readmore', 
       50, 4);

    The filter is added with priority 50, so it will be inserted after the excerpt. The function only inserts the “Read More” link if the class="readmore" parameter is used in the AutoNav invocation, and only if posts are listed, and only if the post actually had an excerpt.

    NOTE: The above was originally asked here.

    Displaying Posts with AutoNav

    January 27th, 2013 by bill

    Here are a few examples of using AutoNav to display posts, as a live demo on this site.

    The most recent 3 published posts

    [autonav display="posts,list,title,nothumb" count=3 postid="status:publish"]

    The alphabetically-first three posts

    [autonav display="posts,list,title,nothumb" orderby="title" count=3 order="ASC" postid="status:publish"]

    Three random posts

    [autonav display="posts,list,title,nothumb" orderby="rand" count=3 postid="status:publish"]

    (refresh this page to see different random posts).

    Posts that must be in two categories

    [autonav display="posts,list,title,nothumb" postid="category__and:autonav-plugin,plugin-compatible"]

    Selecting attachments by tag

    August 27th, 2012 by bill

    With AutoNav, you can now select attachments from any post or page using:

    [autonav display="attached" postid="-1,tag:dessert" orderby="rand" count="6"]

    which would display a gallery of six images, randomly chosen from all the attachments (regardless of their parent post or page) and tagged with the “dessert” tag with the Media Tags plugin.

    Live demo from this site:

    1986: Z-110 with LS Software MegaDisk (below) OLYMPUS DIGITAL CAMERA P9120077
    OLYMPUS DIGITAL CAMERA P9130080 P9080060

    Note that, because the Media Tags plugin is not installed, and because we have not set the correct taxonomies on the AutoNav settings on the WordPress administration screens on this site, that six random attachments from the entire site are displayed in the above example.

    For correct operation, you must set the attachment taxonomy to “media-tags” for the Media Tags plugin; for the Attachment Taxonomy plugin, use “attachment_tag”. Other taxonomy names are permissible in hopes of being compatible with future WP versions.

    AutoNav and Attachment Taxonomy Support

    August 27th, 2012 by bill

    The AutoNav plugin now supports the tag and category taxonomies that the Attachment Taxonomy Support plugin creates. Once you go thru the AutoNav settings screens. you can for example use:

    [autonav display="attached" postid="tag:chocolate"]

    to display a gallery of all images, attached to the current post or page, and having the tag “chocolate” … or you can even do:

    [autonav display="attached" postid="-1,category:dessert"]

    which will display a gallery of images in the “chocolate” attachment category, attached to any post or page.

    Grand Falls, Arizona

    April 23rd, 2012 by bill

    The Grand Falls of the Little Colorado River, northern Arizona

    Panoramic View
    A few metres upstream the river is at ground level
    The falls are taller than Niagara, although there was just a trickle of water this day

    Standing on a corner in Winslow, Arizona

    Listing categories with AutoNav

    November 12th, 2011 by bill

    Let’s explore how we can use the AutoNav plugin for WordPress to display some posts from a category.

    (Note: We assume here at least version 1.4.5 of AutoNav).

    This will display a list of all the posts in the dessert category, five at a time, with page navigation if there are more than 5. The count=-1 means display all the posts (without that, only the most recent 5 would be displayed)


    Now let’s add a custom function which will display the post date, and the modification date if different:

    Put this in your theme’s functions.php:

    function autonav_list_date($html, $class, $pic, $attr) {
      $postdate = substr($pic['page']->post_date,0,10);
      $postmodified    = substr($pic['page']->post_modified,0,10);
      $html    .= "<br>Posted $postdate" ;
      $html .= ($postdate == $postmodified)?'':" (last modified $postmodified)";
      return $html;
    add_filter('autonav_create_list_item', 'autonav_list_date', 50, 4);

    Now let’s change that so only invocations with a specific class will activate that function in AutoNav lists:

    function autonav_list_date($html, $class, $pic, $attr) {
      if ($attr['class'] == 'withdate') {
        $postdate = substr($pic['page']->post_date,0,10);
        $postmodified = substr($pic['page']->post_modified,0,10);
        $html .= "<br>Posted $postdate" ;
        $html .= ($postdate == $postmodified)?'':" (last modified $postmodified)";
      return $html;

    This now needs to be invoked with:
    [autonav display="posts,list" postid="category:dessert" paged=5 count=-1 class="withdate"]

    More AutoNav filters

    October 30th, 2011 by bill

    Missing Image text replacement

    With AutoNav 1.4.5 and above: Replace the “Missing Image” text (when a page or post does not have any attached or featured image) with the title of the target page/post:

    function my_missing_image($html, $pic) {
      return  $pic['title'];
    add_filter('autonav_missing_image', 'my_missing_image', 10, 2);

    Advanced AutoNav page and post selection

    October 28th, 2011 by bill

    Selecting pages by a custom field

    We received this question:

    I have Autonav and it works great… but how do I do the following?

    I have one parent page with about 200 child pages. I’d like to split up the nav into a few parts (on the same page). For example, all pages labeled “Red” in one group and “Blue” in another.  Can I do this? How?

    Absolutely. For example, I created a custom field called “example” and set the value to either “red” or “blue” in the various child pages. In the parent page, then, you can make a list of these pages with:

    Here are the red pages:
    and the blue pages:

    Note, use pics_only=0 to force listings of pages that do not have thumbnails. For a table instead of a list, you could of course use display=images instead of display=list (and you will probably want to omit pics_only).

    Postid Combinations: Creating a “teaser” list

    Starting with version 1.4.5, multiple postid selectors may be used. For example, we can create a “teaser” of upcoming posts as follows:

    Stay tuned for these thrilling accounts of the end of it all!

    That code will create a list of future (schedule) posts, having the tag ‘apocalypse’ … but without any links, just the post title.  (Unless a user can guess the exact URL, by knowing the exact future date, and the exact  ‘slug’ of the post, such posts should remain more-or-less secret.)

    AutoNav 1.4.5 update beta2

    October 27th, 2011 by bill

    Now in the works is an update to AutoNav — 1.4.5 is our current internal version. This update will feature:

    • Supports the Media Tags plugin with the new id=”tag:tagvalue” selector for display=”attached”
    • id= is now an alias for postid=
    • Replaces glob() with opendir() and readdir(). Caches directory information for faster operation with multiple AutoNav invocations on a page/post.
    • A patch to properly name thumbnails of PNGs and GIFs as .jpg
    • Ignores spaces in the display modifiers. New display modifier parsing permits mixed modifiers: e.g., postid="category:recipes,tag:dessert"
    • Missing-image and other errors displayed inside an autonav-error span element, so their display can be disabled. Also a new filter autonav-missing-image to edit or replace that text.
    • Support custom post type and taxonomy names with dashes
    • New filters permit additional thumbnail processing:
      • autonav_thumb ( $pic_info, $attr, $post )
        Given the shortcode parameters in $attr and a page or postid in $post, if $pic_info is empty, then possibly create a $pic_info record with thumbnail image information. By default the chain of searches is featured image, specified image (in the subpage-thumb custom field), and the first attached image. An additional auxiliary plugin is planned to support NextGEN Gallery thumbnails.
      • autonav_get_thumbnails ($pics_info, $attr, $pic_size_info)
        Takes a list of pages/posts/images in $pics_info, and the shortcode parameters in $attr, along with the list of found images-and-associated-thumbnails in $pic_size_info; for each entry in $pics_info, either chooses an image from $pic_size_info or else creates a resized image. Returns an updated $pics_info.
    • New filters permit pre-and post-processing during image resizing:
      • autonav_image_create ($image_resource, $pic_full_path, $attr, $ext)
        If $image_resource is NULL, and given the original file in $pic_full_path having the extension type $ext (e.g., “jpg”), then using the shortcode parameters in $attr, attempt to create and return a PHP image resource from the file.
      • autonav_resize_image ($from_image, $attr, $prefix)
        Accepts a PHP image resource in $from_image, and based on the shortcode parameters in $attr and the thumbnail prefix size (e.g., ‘medium’), returns either the original $from_image or a resized or filtered PHP image resource. NOTE: The filter must compute the size of its input image with the imagesx() and imagesy() functions.
    • New filters for extensions like NextGEN Gallery thumbnail support, and for taxonomy-images plugin. These are then implemented in auxiliary plugins, or theme files.

    If you are interested in beta-testing, please download here and email Bill with your comments or issues.