Search

WordPress Plugin: Category/Archive Indexing


By default, WordPress displays categories and archive listings in blog form -- that is, by showing either excerpts or the entirety of the last N posts (dependent upon theme). While this is great for reading, it’s less than wonderful when searching for specific past entries.

Category/Archive Indexing is a WordPress plugin that helps replace the blog style category and archives listings with a list of links to each individual post. It will also work with Simple Tagging Plugin tags.


(Actual look may vary depending on theme)

For a better idea of what this plugin can do, here are some sample pages from this site: a category index, a tag from the tag cloud, and a link from the monthly archive.

To install the plugin:

1) Download the plugin.
2) Upload the plugin to your wp-content/plugins directory.
3) Activate the plugin.

The plugin provides three functions:

function CAI_Header($headerStyleStart='

', $headerStyleEnd='

')

CAI_Header() displays a heading on the page between the $headerStyleStart and $headerStyleEnd elements. In the above picture, it is responsible for the “Category: WordPress” header.

function CAI_SetNumberOfPosts($limit)

CAI_SetNumberOfPosts() determines how many links to show. If you want to show all the links in a category/archive, set it to an arbitrarily large number, such as 99999. If you do not call this function, the default will be however many posts you have set to display on your front page.

function CAI_DisplayLink($beforeLink='', $afterLink='
')

CAI_DisplayLink does the actual displaying of the link itself, and goes inside the_loop. It contains two parameters that you can use to provide customized style elements. $beforeLink can be set to

  • if you would like to display your links as part of an ordered or unordered list.

    Unfortunately, the plugin is not plugin-and-play. To use the plugin, you will need to modify (or create) an archive.php and/or category.php in your theme directory. You can use the following template for both, which will work with many themes:

    
     
    
    

    The div HTML element needs to be altered to match your theme. It tells the browser how to format the list of links. The best way to figure out what to use is to look inside your index.php. The first div you run across is likely to be the one you want. Simply replace the div in the above template with the first div from your index.php and you will probably be good to go.

    For example, the first div found in the wp-andreas01-12 theme index.php is

    . For that theme,

    should be replaced with

    .

    You can also change the CAI function parameters to reflect your tastes.

    Tiga fans, the following zip file contains an archive.php and category.php. Extract them to your wp-content/themes/tiga-06 directory.

    Author’s note: I am not a PHP coder, nor a WordPress expert. This plugin was cobbled together after examining other people’s code and a lot of trial and error. If you have any comments about things I could do better/differently, I’d love to hear it.

    14 comments to WordPress Plugin: Category/Archive Indexing

    • I did not understand how to change and what to change. I changed to function CAI_SetNumberOfPosts(99999)

      but it shows
      Parse error: syntax error, unexpected T_LNUMBER, expecting '&' or T_VARIABLE in /home/pisqacom/public_html/wp-content/plugins/CatArcIndexing.php on line 38

      I dont have much knowledge of editing and these scripts... so can you please prepare a simple php file which i can simply upload that file and activate... and it shows all article links or list when i click on category or archive.. Please help

    • Hello; I was able to manage getting the plugin to work; however, on my website it seems that when I click to see the directory, I'm missing my left sidebar.

      Also I was wondering if there was any way for this plugin to list child categories. before posting articles.

    • One of the reliable ones I trust is the ManualDirectorySubmission.in from India. They seem to be much better than the rest.

    Leave a Reply

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">