I’ve been hovering on the WordPress forums recently, keeping my eyes peeled for a solution to my missing media buttons following up my upgrade to WordPress 2.5 a week or so ago. Today, prompted by a post by jeenie involving looking at the source code, I had a poke around and managed to get half way there. As you can see from the attached screenshot (which proves it all works!!), I can now access the functionality, even though the images still don’t show. It’s a curious thing, given that it looks like a fairly simple bit of code that oughtn’t to have any problems at all.
The code for this bit looks like this:
<div id="media-buttons" class="hide-if-no-js">
<a href="media-upload.php?post_id=439&type=image&TB_iframe=true&height=500&width=640" class="thickbox" title='Add an Image'><img src='images/media-button-image.gif' alt='Add an Image' /></a>
<a href="media-upload.php?post_id=439&type=video&TB_iframe=true&height=500&width=640" class="thickbox" title='Add Video'><img src='images/media-button-video.gif' alt='Add Video' /></a>
<a href="media-upload.php?post_id=439&type=audio&TB_iframe=true&height=500&width=640" class="thickbox" title='Add Audio'><img src='images/media-button-music.gif' alt='Add Audio' /></a>
<a href="media-upload.php?post_id=439&TB_iframe=true&height=500&width=640" class="thickbox" title='Add Media'><img src='images/media-button-other.gif' alt='Add Media' /></a>
I’ll quickly explain what this does: everything is contained within a DIV, with a unique id “media-buttons” and a class “hide-if-no-js”. The one that really stuck out for me was the class, and a quick look in the CSS revealed that the class “hide-if-no-js” did exactly what you’d expect – it hid everything inside it. I simply commented out that line in the CSS file, and found that the links suddenly worked!
If you want to try this yourself (if you’re having the same trouble as me), the file you want to look at is …/wp-admin/wp-admin.css, and the offending item is right down at the bottom of the file, and looks like this:
Now, this is only a partial fix, as although I can click on the links and access the functionality behind them, the icons for those buttons still don’t appear. I’ve checked, and the image files themselves are definitely there. I’ve even manually edited the HTML using a bookmarklet to temporarily remove the link around the image, and then it displays perfectly, just without the link and hence without the functionality associated with it.
So I had a look at the link, to see if that’s where the problem lay. Sadly, that yielded nothing of use; the #media-buttons CSS had nothing relevant, neither did the .thickbox in the link. So I’m at a loss again. For now.
Still, at least I’ve got the functionality working now, that’s a significant improvement. Unfortunately it hasn’t resolved the problems I’m also having with the Add Link buttons, which give me a blank popup. Ah well, I’ll just have to investigate further, or make do with the HTML editor.