ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If brew is already installed
| <?php | |
| /** | |
| * NOTE: This gist is very old. You might want to check out recent forks | |
| * like this one: https://github.com/Alexlytle/Wordpress_custom_route/blob/main/Wordpress_Custom_route.php | |
| * (thanks @Alexlytle) If you have an improvement to this gist, please | |
| * post a link in a comment for others who might benefit. Thanks! | |
| * | |
| * A class to create simple custom routes. | |
| * |
| <?php | |
| /** | |
| * Inspired from: https://gist.github.com/dazecoop/548b2621e86fb030da8e5adb1bfe484f | |
| * | |
| * How to use: | |
| * - add to your function.php or related | |
| * | |
| * What you can use it for: | |
| * Variable products: | |
| * - you have variable product with some attributes not used for variations |
| <?php | |
| /* | |
| * Plugin Name: WordPress.com Watermark Image Uploads | |
| * Author: Alex Mills | |
| * Author URI: http://automattic.com/ | |
| */ | |
| class WPcom_Watermark_Uploads { | |
| public $watermark; |
| #!/bin/bash | |
| # My custom script to configuring TinkerOS post install as a desktop replacement. For personal use | |
| sudo apt-get update | |
| # disable swap to reduce SD card wear | |
| sudo swapoff -a | |
| # Setup numlockx for default numlock on at startup | |
| sudo apt-get install numlockx |
| <?php | |
| // Do NOT include the opening php tag. | |
| // Place in your theme's functions.php file | |
| /** | |
| * Add a custom field (in an order) to the emails | |
| */ | |
| add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 ); | |
| function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) { |
| add_filter( 'post_type_link', 'my_post_type_link', 10, 3); | |
| function my_post_type_link($permalink, $post, $leavename) { | |
| if ($post->post_type == 'my-post-type') { | |
| $meta = get_post_meta($post->ID, '_my-post-meta', true); | |
| if (isset($meta) && !empty($meta)) | |
| $permalink = home_url( "my-friendly-url/" . $meta . "/" . $post->post_name . "/"); | |
| } | |
| return $permalink; |
| php_value upload_max_filesize 64M | |
| php_value post_max_size 64M | |
| php_value max_execution_time 300 | |
| php_value max_input_time 300 |
| function upload_svg_files( $allowed ) { | |
| if ( !current_user_can( 'manage_options' ) ) | |
| return $allowed; | |
| $allowed['svg'] = 'image/svg+xml'; | |
| return $allowed; | |
| } | |
| add_filter( 'upload_mimes', 'upload_svg_files'); |
| function defer_parsing_of_js($url) | |
| { | |
| if (is_admin()) return $url; //don't break WP Admin | |
| if (false === strpos($url, '.js')) return $url; | |
| if (strpos($url, 'jquery.js')) return $url; | |
| return str_replace(' src', ' defer src', $url); | |
| } | |
| add_filter('script_loader_tag', 'defer_parsing_of_js', 10); |