WordPress.org

Ready to get started?Download WordPress

Forums

WP Glossary
[resolved] [Hack] A to Z Glossary Terms Starting With Numbers (2 posts)

  1. xstortionist
    Member
    Posted 1 year ago #

    Hi there,

    This is a lovely plugin that I used for a client. Had a hell of a time trying to get numbers included with the A-Z Glossary Terms Shortcode. Gave the info to a good friend of mine Eric Baum to take a look and he managed to create a simple hack that places all glossary term posts starting with a number to be placed under a pound symbol "#".

    Below is the directions to get this working for you.

    Open file wp-glossary.js and add this line of code below line 38.

    //if( myAlpha.length )
      try {
        $('.atoz-clickable').filter(function(i){return $(this).attr('alpha') == myAlpha;}).click();
      } catch (err) {  }

    After you do that, open glossary-atoz-shortcode.php and add this line of code below line 30.

    if (!ctype_alpha($alpha)) $alpha = '';

    Add this below line 45.

    $range = array_merge(Array(''), $range);

    Add this below line 51.

    $char = ($alpha == '') ? '#' : $alpha;

    Add this below line 55.

    $menu .= '<a href="#' . $alpha . '">' . $char . '</a></li>';

    That's it! When I get back to my home office, I'll upload the files so you can download them without having to edit the actual code itself. I believe there are some additional if statements added as well. If anything, this will steer you in the right direction.

    Enjoy!

    http://wordpress.org/extend/plugins/wp-glossary/

  2. TCBarrett
    Member
    Plugin Author

    Posted 1 year ago #

    Hi xstortionist

    Do you have access to a test environment? Would be great if you could download the latest beta (2.0-beta-2) and let me know if that handles numbers and non-english characters better.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic