Category Developer Notes
Single Command to Remove Missing Files and Add New Files into SVN
This is a short entry. If you have a WordPress.org theme/plugin, here’s a single command to add all new files and remove all missing files in SVN: svn add `svn st|grep “^?”|awk ‘{print $2}’x` svn rm `svn st|grep “^\!”|awk ‘{print…
How to Perform an Action Only Once in WordPress
The add_action function is the main function to use when creating WordPress plugins. You mainly use it for executing code at various run time points within WordPress. With this function, you can create shortcodes, enqueue scripts, styles, modify post titles and contents…
PHPUnit Installer Script that Works in Travis CI and Locally for VVV
Travis CI is great and we’re using a very (VERY) simple singular test that just checks whether or not Titan Framework encounters any activation errors. As of the moment we haven’t wrote any other detailed tests for Titan, and that…
Using IDs or query_vars instead of slug names in get_post_types
Here’s one that had my head scratching for a while. We are currently developing a much-sought-after update for Carousel Anything, and it involves enumerating post types, taxonomies and terms. On a routine testing en route to being a candidate build,…
Converting Relative URLs to Absolute URLs in PHP
We needed to convert relative URLs to absolute URLs inside CSS files for our upcoming plugin Combinator. There are a lot of code floating online that partially worked. The one that was closest was from Here’s the reworked version…
How to Use the Javascript YouTube API Across Multiple Plugins
When using the YouTube API, you are required to create the function onYouTubePlayerAPIReady. There is a huge problem with this. If you have multiple WordPress plugins that use the YouTube API, that means that you have multiple declarations of onYouTubePlayerAPIReady.…
WordPress: How to Add a Button in the Admin Bar
This snippet will add a button on the admin bar: add_action( ‘admin_bar_menu’, array( $this, ‘addToggleButton’ ), 99 ); public function addToggleButton( $adminBar ) { $args = array( ‘id’ => ‘my_button’, ‘title’ => ‘My Button’, ‘href’ => ‘#’, ‘meta’ => array(…
Tip: Detecting a Mobile Browser with Javascript
There are a lot of existing ways to detect whether the browser is being used in a mobile device. You can use Modernizr to check for Touch support, check for whether Touch events are supported by the browser, or check…
Image Dimensions Get Lost when JetPack’s Photon is Activated
Jetpack issue submitted: If you do this: $attachmentImage = wp_get_attachment_image_src( 1234, ‘full’ ); $url = $attachmentImage[0]; $width = $attachmentImage[1]; $height = $attachmentImage[2]; $width and $height should give out the image dimensions, but when Photon is activated, both don’t get returned.…