This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.
Use it like this!
| # | A | B | C |
|---|---|---|---|
| 1 | a | b | slug |
| 2 | foo | baz bing | =slugify(A2:B4) |
| 3 | bar | BAZ | |
| 4 | FOO | baz-bing |
This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.
Use it like this!
| # | A | B | C |
|---|---|---|---|
| 1 | a | b | slug |
| 2 | foo | baz bing | =slugify(A2:B4) |
| 3 | bar | BAZ | |
| 4 | FOO | baz-bing |
| <?php | |
| /** | |
| * Limit WordPress media uploader maximum upload file size | |
| * Uploading very large images is pointless as they will hardly ever be used at full size. | |
| * Crunching larger files takes more memory; larger files take more space too. | |
| * | |
| * @param mixed $file the uploaded file item to filter | |
| * | |
| * @return array $file the filtered file item with response |
| <?php | |
| namespace GM\VirtualPages; | |
| /** | |
| * @author Giuseppe Mazzapica <[email protected]> | |
| * @license http://opensource.org/licenses/MIT MIT | |
| */ | |
| class Controller implements ControllerInterface { | |
| private $pages; |
| <?php | |
| global $wp_embed; | |
| $video_url = 'https://www.youtube.com/watch?v=b7mixrO2lzA'; | |
| echo $wp_embed->run_shortcode( '[embed]' . $video_url . '[/embed]' ); |
| <?php | |
| /** | |
| * Get Post object by post_meta query | |
| * | |
| * @use $post = get_post_by_meta( array( meta_key = 'page_name', 'meta_value = 'contact' ) ) | |
| * @since 1.0.4 | |
| * @return Object WP post object | |
| */ | |
| function get_post_by_meta( $args = array() ) |
| <?php | |
| function get_widget_instance( $widget_id ) { | |
| global $wp_registered_widgets; | |
| if ( empty( $wp_registered_widgets[$widget_id]['callback'] ) ) | |
| return array(); | |
| /** @var WP_Widget $widget */ | |
| $widget = $wp_registered_widgets[$widget_id]['callback'][0]; |
| // Check if we are in a local environment | |
| function is_localhost() { | |
| // set the array for testing the local environment | |
| $whitelist = array( '127.0.0.1', '::1' ); | |
| // check if the server is in the array | |
| if ( in_array( $_SERVER['REMOTE_ADDR'], $whitelist ) ) { | |
| /* | |
| * Replace all SVG images with inline SVG | |
| */ | |
| jQuery('img.svg').each(function(){ | |
| var $img = jQuery(this); | |
| var imgID = $img.attr('id'); | |
| var imgClass = $img.attr('class'); | |
| var imgURL = $img.attr('src'); | |
| jQuery.get(imgURL, function(data) { |
| <?php | |
| // Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
| // http://youtu.be/dQw4w9WgXcQ | |
| // http://www.youtube.com/embed/dQw4w9WgXcQ | |
| // http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
| // http://www.youtube.com/?v=dQw4w9WgXcQ | |
| // http://www.youtube.com/v/dQw4w9WgXcQ | |
| // http://www.youtube.com/e/dQw4w9WgXcQ | |
| // http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |