Working on a project today I needed to have 99 WordPress rich editors (powered by TinyMCE) on one page, and let me tell you, this absolutely kills the page load time! In the first iteration I’d done this purely in PHP using wp_editor, like this… $value = ”; //this is the current value if there…
Using Git to see earlier code versions
I couldn’t think of a good title for this post, but this was the problem I found myself in, whilst doing some WordPress theme development. I came to my computer this morning to continue work, and noticed that there was an “error_log” file in the “wp_admin” folder on the server. So I downloaded it, had…
Sending HTML emails in WordPress
Sounds simple, but WordPress defaults to text emails, so if you want to send pretty HTML ones, then you need to let it know. Previously I have done this in a bit of a convoluted way… add_filter(‘wp_mail_content_type’,’set_html_mail_content_type’); wp_mail($to_address, $subject, $message); remove_filter(‘wp_mail_content_type’,’set_html_mail_content_type’); This relies on this function to work… function set_html_mail_content_type() { return ‘text/html’; } You…
Updating WordPress post metadata
I was fighting with a WordPress issue earlier today, and the solution turned out to be pretty simple, and a clear case of me not reading the WordPress developer resources properly. The situation arose because I was updating a number of post metadata fields and trying to count the number of edits, like this… $count…
Git aliases (updated)
Almost 2 years ago now I wrote about the Git aliases I was using. And I still use most of them, but I’ve also added a few new ones worth talking about. Backing up slightly, I’m talking about creating shortcuts to improve your workflow. For example, I like to use the short form of git status most of…
WordPress, why no get_the_widget?
So the problem I was having the other day was that I wanted to be able to output a widget on a WordPress custom theme archive page, but I didn’t know where the user wanted to put it, or what attributes they wanted to pass in, it needed to be really flexible (isn’t that always…