Category Developer Notes

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…

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…

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(…

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.…