Please help support the continued development of AZIndex, particularly if you are using the plugin in your work or as part of a for-profit website. All contributions, no matter what size, will be gratefully received.

Indexes Everywhere

Once you have created an index, where can you put it?  The short answer (no pun intended) is—anywhere you can put a shortcode.  Whenever you create an index, the plugin automatically creates a new blog page for the new index and adds the appropriate shortcode to the page contents so that the index will appear when the page is accessed.

If you edit the new page, you will see something like this in it:

[az-index id="4" escape="true"]

where the id parameter is set to the id of the index.  Everything inside and including the brackets [] is an AZIndex shortcode.

Now, you can leave the shortcode where it is, publish the page, and you have your index, but you can also copy the shortcode into other places in your blog, if you would prefer to have the index showing up somewhere else.

There are four different place you can put the shortcode:

  1. In another page. You can copy the shortcode from the original page and paste it into any other existing page on your blog.
  2. In a blog post.  An index will work just as well in a post as it does on a page (if it’s not too big!).  Just paste the shortcode into your selected post.
  3. In a text widget. Yes, indexes work in text widgets too, though it does take a little more work.  Before shortcodes will work inside a text widget, you have to add the following line of code to your theme template (usually in functions.php), or somewhere else it will be executed—perhaps in plugin:
    add_filter('widget_text', 'do_shortcode');

    Now you can add the shortcode into your text widget and the index will show up in there.  (Just remember that you usually don’t have much room in a sidebar widget, so be careful about the size of the index you are dropping in there!)

  4. In a theme template. If you want an index to appear somewhere else in your blog—in the footer, for example—you can also add the shortcode to one of your template files.  But because a shortcode is neither valid PHP or valid HTML, you have to use the WordPress function do_shortcode instead, to insert the index:
    <?php echo do_shortcode('[az-index id="4" escape="true"]');?>

Finally, remember that you can use the same index in multiple place in your blog.  I’m not sure how useful that is, but you can make copies of the same shortcode in as many places as you want.

Continue to the next page »

Comments are closed.