Innerdvations

21Mar/120

Any Parent

Allows you to select any page as a parent page (for example, draft and scheduled pages).

Currently changes the settings for all post types, but future versions will allow settings to apply to specific post types, and also allow specific post types to be set as possible parents to different post types.

flattr this!

Filed under: WordPress No Comments
15Sep/110

Translate role names in your WordPress plugin or theme

I've been working on a plugin that needs to print a list of all role names with a checkbox next to them. But when you get the printable role name from $wp_roles->roles[$x]['name'], you only get the English name. The translation isn't stored anywhere in $wp_roles. Also, since it's a variable, you can't use one of the basic gettext functions like __() or _e() to have someone provide translations for you (although even if you could, that would be a dirty way of doing it).

To get the translated role names that are already included in WordPress, use translate_user_role() on that full English name rather than translate_with_context().

I don't know why it's virtually undocumented, so it's possible there's a negative to doing it this way, but that's actually the function used by core to get the translated dropdown menu.

Filed under: WordPress No Comments
1Sep/113

Make Safe For Work

I wasn't satisfied with the Not-Safe-For-Work WordPress plugin I found, so I wrote one that has far more features than you'd ever imagine a silly plugin like this to have.

The default method, reload, doesn't send any of the offending content to the user's browser until they click on the reveal link, so if someone is behind a filter that prevents them from loading pages with certain words, they'll still be able to view your page.

Here are some demos of the different types available. The spoiler type handles images and advanced styling about as well as you'd expect (exceedingly poorly) but it uses visibility:hidden instead of just trying to turn everything black, so at least it always works.

original text:
really seriously unbelievably long swear word that exceeds all expectations

Standard method (first tag):
                                        [Not Safe for Work. Click to View.]                                       

Standard method (after first tag):
                                                                    [NSFW]                                                                     

Spoiler method:
really seriously unbelievably long swear word that exceeds all expectations

Deleted (never show anything, no idea why you'd want this):
                                                                [redacted]                                                                 

Comment (view source):

flattr this!

18Aug/110

“Error Saving Media Attachment”

I recently had a client trying to upload a file in WordPress, but each time WordPress would display "Error Saving Media Attachment."  I knew that permissions on the upload folder had been set properly since other files were uploading fine.  Then I noticed that it was a Word document, and all the other uploaded files were images or PDFs.

It turns out that WordPress only allows uploading certain filetypes, and .doc files weren't in the list.  If you're using WordPress Multi-user, it might be as simple as going to Network Admin, then Settings -> Network Settings and change the "Upload file types".

If you're still having problems,  just add something like this to your functions.php:

function add_upload_mimes ($mimes=array()) {
    $mimes['docx']='text/plain'; // add your file extension, such as docx
    return $mimes;
}
add_filter("upload_mimes","add_upload_mimes");

Or, if you're too lazy for that, try out the PJW Mime Config plugin.

Filed under: WordPress No Comments
17Aug/1138

Dashboard Site Notes

Important note for anyone who installed version 1.3.0: Please read my two posts in this thread to fix the problem with the plugin causing your site to run slow and then update to the latest version. Sorry for any inconvenience!

Nearly every WordPress site I've built has something that falls outside the standard WordPress instruction manual.   I wrote this plugin as a way to easily add little notes in places where they're needed to keep clients from feeling lost when trying to do one of those custom operations.

flattr this!