- Initial Server Setup with Ubuntu 12.04
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04
- A Basic MySQL Tutorial
- How To Install phpMyAdmin on a LEMP server
- How To Install Git on Ubuntu 12.04
- Generating SSH Keys and connect with DigitalOcean
- Install Composer on DigitalOcean
- [Install php5-cli if you get stuck with installing Compos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| <?php | |
| // filter the Gravity Forms button type | |
| add_filter("gform_submit_button", "form_submit_button", 10, 2); | |
| function form_submit_button($button, $form){ | |
| // The following line is from the Gravity Forms documentation - it doesn't include your custom button text | |
| // return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>"; | |
| // This includes your custom button text: | |
| return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>"; | |
| } | |
| // Oops this strips important stuff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Exclude scripts from Scripts to Footer plugin | |
| * http://wordpress.org/plugins/scripts-to-footerphp/ | |
| * | |
| * In this example, we will use jQuery (hosted on Google's servers even) | |
| */ | |
| add_action( 'wp_print_styles', 'jdn_deregister_scripts', 100 ); | |
| add_action( 'wp_head', 'jdn_head_scripts' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| stat -c "%a %n" * | |
| // -c is for file format, %a is for octal, %n is for file name | |
| //http://geeklog.adamwilson.info/article/58/getting-file-permissions-in-octal-on-OS-X | |
| //OSX Yosemite does not work with -c use: | |
| stat -f '%A %a %N' * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| <?php | |
| // check if the flexible content field has rows of data | |
| if( have_rows('flexible_content') ): | |
| // loop through the rows of data | |
| while ( have_rows('flexible_content') ) : the_row(); | |
| //check current row layout | |
| if( get_row_layout() == 'pricing' ): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0; | |
| var isMacLike = navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i)?true:false; | |
| var isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i)?true:false; |
Note: if you need a simple connection icon, check out BitBar and its internet checker plugin.
This program notifies you when Internet goes down and when it comes back up.
It pings Google's DNS every 4 seconds; when a ping fails it quickly tries a few more times and switches to downtime mode. When Internet is available again, the cycle restarts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| /** | |
| * WooCommerce Quanity buttons add-back | |
| */ | |
| jQuery( function( $ ) { | |
| var $testProp = $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).find('qty'); | |
| if ($testProp && $testProp.prop('type') != 'date') { | |
| // Quantity buttons | |
| $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' ); | |
| // Target quantity inputs on product pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| //Enable shortcodes in WordPress SEO generated Meta Description with HTML removed | |
| add_filter( 'wpseo_metadesc', 'am_enable_shortcodes_removed_html' ); //see https://yoast.com/wordpress/plugins/seo/api/ | |
| function am_enable_shortcodes_removed_html($metadesc) { | |
| if( strpos($metadesc, 'et_pb_section') !== FALSE ) { | |
| global $post; | |
| $rendered_content = apply_filters('the_content', $post->post_content); | |
| $newmetadesc = strip_tags( $rendered_content ); | |
| return substr($newmetadesc, 0, 156); |