Wowhead powered ItemStats for WordPress

by Jon on November 7th, 2007

UPDATE:

With recent updates to WordPress and the lack of development support for the ItemStats Plugin, there’s now a new (and much easier method) for adding WoWhead item links to your blog.

Step 1: Add the following code to the <head> section of header.php (\wp-content\themes\yourtheme\header.php):

<script src="http://www.wowhead.com/widgets/power.js"></script>

Step 2: Create a link to any wowhead item (ex: Dark Iron Smoking Pipe)

Step 3: Enjoy

//END UPDATE

Maybe you’ve noticed our new fancy-pants item popups (ex: [item]Tenacious Defender[/item])?

Since a lot of you have your own blog, (we’re updating our blogroll on a daily basis with all the new finds) I figured I’d give a quick rundown on how to implement the item popups for WordPress. If you’re using something else like Blogger, Resto4Life has a nice rundown on a database-agnostic method here.

If you’re willing to get your hands dirty, ItemStats is an awesome plugin that gives you a completely automated and dynamic item linking experience. The only hangup that I have with Itemstats is that it doesn’t support Wowhead out of the box. It supports Thottbot and Allakhazam for english item queries but Wowhead is the superior database in my opinion.

For this installation you can download my prepackaged zip here, or you can pick up the ItemStats core, the WordPress Module, and the additional Wowhead code (install in this order).

First and foremost, make sure everything is backed up (I highly recommend utilizing a sandbox environment to test things out in). Unzip the contents of the zip file to the root folder of your WordPress Blog (this folder should contain the wp_content and wp_admin folders as well as a slew of wp-*.php files and is most likely either the root of your website or the /blog/ subfolder).

Now if you choose to use the all-in-one ItemStats-WowHead.zip file, the only thing that requires input is the itemstats/config.php file–update this file with your own database information. Contact your hosting provider if you’re not sure of your WP database location or credentials.

If you went with the separate installation method, make sure to check out the readme files in each respective archive to determine which files need to be modified.

After everything is unzipped and in its place, login to your WordPress Admin and head over to the plugins section and activate ItemStats. Now to add an item to your one of your posts, all you need to do is include the item’s name or id surrounded by the [item] tag somewhere in your text. ItemStats parses out the [item] code and replaces it with a swanky popup when you hover over the link with your mouse. It also caches data and downloads the icon for items you’ve already linked so you’re not constantly making trips to Wowhead’s servers.

Examples:

[item]3567[/item] produces [item]3567[/item]

[item]Fight Club[/item] gives you [item]Fight Club[/item]

You can even use the icon instead of text with the [itemico] tag if you fancy.

[itemico]A Frayed Knot[/itemico] magically conjures [itemico]A Frayed Knot[/itemico]

One nasty issue that I did come across was the inability for the plugin to create the item_cache table in the database. I’m not sure why this happened and it may not happen to you, but if it does, it’s a simple fix.

Just execute the following query on your WordPress Database:

CREATE TABLE IF NOT EXISTS `item_cache`
(`item_name` varchar(100) NOT NULL DEFAULT ”,
`item_id` varchar(100) DEFAULT ’0′,
`item_lang` varchar(2) DEFAULT ”,
`item_link` varchar(100) DEFAULT NULL,
`item_color` varchar(20) NOT NULL DEFAULT ”,
`item_icon` varchar(50) NOT NULL DEFAULT ”,
`item_html` text NOT NULL,
UNIQUE KEY `item_name` (`item_name`),
FULLTEXT KEY `item_html` (`item_html`)) ENGINE = MyISAM;

Again, get your hosting provider to help if you don’t have access (phpadmin will work) or aren’t that comfortable with haxing your datas.

If any of you have any issues, feel free to drop me a line. I’ll be happy to help out.

Thanks to Yahourt for the original code and to Frank Matheron over at the EQDkp Forums for the Wowhead modification.


From General

37 Comments
  1. SeiferTim permalink

    That’s GREAT!
    I wrote something similar using Thottbot on my now-defunct guild’s phpBB forum, a few years ago.
    I plan to use this though. Thanks!

  2. Rip permalink

    does this require you to have your own wordpress installation, or can you use this with just a wordpress web account?

  3. Raisa permalink

    This looks awesome, I must be doing something incorrectly even though I’ve followed your instructions exactly more than 10 times lol but I just can’t get it to work =(

  4. thanks for the write up on including item stats… Mine is working except that there appears to be only one icon in the wowhead icons folder on my server and its the question mark…

    my question is, do i need to chmod this icon folder to accept the updated icon information coming from wowhead?

    the cache table is in place in my database also

  5. Is there anyway to change the alpha (transparency) on the tooltips?

    Also, I’m having issues downloading the item icons – when I set the download directory, it breaks my forums. >.<

  6. Erm, also – white items show up very poorly against a white background – is there anyway to change that?

  7. thank you

  8. idoreommivy permalink

    Hello!
    Nice site ;)
    Bye

  9. Why do some items work and other do not? I have been using both Thotbot and Allakazham to get the item name but for some reason some items just continue to show a question mark.

    Any help totally appreciated.

  10. The images seem to be broken. The icons in the tooltip. They were working fine and then they just stopped working. I tried to host all the icons myself like I used to do with itemstats to see if it was a wowhead problem but still no joy. I noticed the icons on your tooltips stopped working too. Any idea whats up?

  11. Dzikyxap@EU Molten Core permalink

    You need to change this (state to April 2008) in config.php:
    define(‘ICON_STORE_LOCATION’, ‘http://static.wowhead.com/images/icons/medium/’);

  12. Thank you, that fixed it.

  13. Dzikyxap, your comment got my icons to go from being blank to being question marks. Any idea?

  14. First, update config.php to have the line in there read as:
    define(‘ICON_STORE_LOCATION’, ‘http://static.wowhead.com/images/icons/medium/’);

    then edit the config_wowhead.php file for the line at the end to read:
    define(‘REMOTE_ICON_STORE_PATH’, ‘http://static.wowhead.com/images/icons/medium/’);

    then go into phpmyadmin and empty the item_cache table. Next time it loads your items, they will display correctly.

  15. @Kris: Any items that returned a blank before you changed the www to static will likely show up as a ? from the cache. You need to clear the cache, or just clear the cache of items with the question mark graphic.

    This query should delete any items that are like that in the cache.
    DELETE FROM item_cache WHERE item_icon = ‘inv_misc_questionmark’;

    Or to clear the whole cache:
    DELETE FROM item_cache;

  16. The file (/itemstats/config_wowhead.php) contains a define for REMOTE_ICON_STORE_PATH which needs to be changed from

    “http://www.wowhead.com/images/icons/medium/”
    to
    “http://static.wowhead.com/images/icons/medium/”

    That is used in (/itemstats/includes/wowhead.php) to download the correct icon if you have DOWNLOAD_ICONS set to true in (/itemstats/config_wowhead.php)

  17. I’m trying not to appear to be stupid but I’m confused. I’m going to use the all-in-one package that you put together.

    What exactly do I do with the config file that is provided? Does it go into the wp-config or stay separate?

  18. Leon permalink

    Hey there, thanks for the addon! I am however having a few problems.

    First of all, the addon gave two tooltips for the same item. One above the cursor, and one below. And now every item displays an error and grey items (item does not exist), the error is removed if i click the item, but the item remins unfound. Any ideas?

  19. Leon permalink

    Actually it has now found the items, but it continues to show 2 tooltips!

  20. I’ve changed “http://www.wowhead.com/images/icons/medium/” with “http://static.wowhead.com/images/icons/medium/” both in config.php and config_wowhead.php, I”ve cleared all db entries in item_cache but I still have the same error: ” The object does not exists…” :( What’s wrong? :/

  21. JAWSOME, OWA GREAT!

    TY guy, very useful!

  22. Mike permalink

    I am getting double tooltips when using this. Any thoughts?

  23. Thanks!

  24. Hi!
    Thanks for putting this all together. I installed them separately on a different website and remember it took lots of tweaking to get it to work right. This seems to work right out of the box. The one problem I am having is that when I mouse over the item, I seem to get 2 boxes popping up with stats (usually overlapping.) I’m not sure what is causing it. I’m running Safari on OS X, but I also tested it in Foxfire and get the same result. I don’t think it’s the browser since the item popups on this page display fine for me. Anyone have any ideas?? Thanks!

  25. Hi All, Sorry for not responding to many of the comments here. I believe that there’s probably a better and easier way to do this by now. I hope to provide an update soon. =)

  26. heya
    thanks for the tips i got mine working no problems!
    just one quick question….is there a way to show achievements and these sort of things in blog posts?

  27. Thanks! I missed the ItemStats functionality.

  28. Hi,

    I’m experiencing the dual tooltip display, i’ve tried the updates as suggested, with the same result. This has been working, but obviously WP is being constantly updated. Any suggestions please?

  29. Still can’t get rid of the dual tooltips, any suggestions please?

  30. For those seeing double tooltips, your issue is most likely that you included BOTH the WordPress plugin as well as the SCRIPT tag (which was an alternate option). Choose one and only one and your double tooltips will go away.

    One issue I’m having is that with I use both of the options together (above) I see the silver and gold icons, but when I remove the SCRIPT javascript include from my header, I see only one tooltip (good) but without the gold and silver icons.

    I see the icon show up for the item itself in the tooltip, but not the currency symbols. Those are the only thing missing. Badass plugin if we can work through that one issue.

    I’ve already edited the DEFINE options in the various config files and tooltips are indeed showing up correctly except for the tiny currency symbols.

  31. Hey!
    Great plugin, love it!

    But there is something strange. Every time i insert an item the item is displayed correctly but it always appears in a next line. It looks like you insert an or tag and the text is always destroyed.

    You can take a look here…
    http://www.wow-goldcap.de/?p=122

    Best regards!

    Any Ideas how to fix this?

  32. this was such a excellent write-up. I am definitely looking forward to the subsequent article.

Trackbacks & Pingbacks

  1. Resto4Life» Blog Archive » Blog Renovation
  2. Lightning Overload » ItemStats Enabled
  3. The Bronze Kettle » Updates

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS