Category WordPress
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,…
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(…