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 | |
| // Add a filter to show featured products, in admin panel for WooCommerce | |
| function woocommerce_filter_products_by_featured_status() { | |
| global $typenow, $wp_query; | |
| if ($typenow=='product') : | |
| // Featured/ Not Featured |
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 | |
| // Get an image for Open Graph - Uses WP Imager https://github.com/Jany-M/WP-Imager | |
| if(is_singular()) { | |
| global $post; | |
| if(function_exists('wp_imager')) { | |
| $img = wp_imager(1200, 630, 1, '', '', '', true ); | |
| } elseif(has_post_thumbnail($post->ID)) { | |
| $img = get_the_post_thumbnail_url( $post->ID, array(1200,630)); | |
| } | |
| } else { |
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 | |
| function add_classes_to_body($classes) { | |
| global $post; | |
| // User Role | |
| $user_info = get_currentuserinfo(); | |
| $classes[] = implode(' ', $user_info->roles); | |
| // WPML | |
| if ( function_exists('icl_object_id') ) { |
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 | |
| /* ---------------------------------------------------------------------------------------------------------------------------- | |
| * PREFACE for this script | |
| * | |
| * A frontend custom form, allowing registered users to create a custom post type + upload images to ACF Gallery custom field, | |
| * in a custom uploads folder, had a bug where it would replace any symbol with -, | |
| * including replacing the file extensions (eg. .jpg and .png, in -jpg and -png). | |
| * That resulted in various issues, even though browsers could still read the file as image. | |
| * After fixing the form itself, this script was made, to fix all the uploads that had already been uploaded and their path. |
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 | |
| /*------------------------------------------------------------------------------------------------ | |
| This specific case assumes the following structure. Please note the absence of file extensions. | |
| MAIN_DIR | |
| - xyz (dir) | |
| -- abc123-jpg (file) | |
| -- xyz456-png (file) | |
| -- jkl123-jpg-300x300 (file) | |
| -- oiu456-png-300x300 (file) |
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 | |
| // Richiede la creazione ed il popolamente delle tabelle https://gist.github.com/Jany-M/7b75ac99f46aaf13ef04587e5e9dd882 | |
| // Richiede la libreria JS Bootstrap Select https://github.com/silviomoreto/bootstrap-select | |
| /* -------------------------------------------------------------------------------- | |
| * | |
| * functions.php | |
| * | |
| -------------------------------------------------------------------------------- */ |
This file has been truncated, but you can view the full file.
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 | |
| $prefisso = ''; // le tabelle non avranno nessun prefisso e saranno: regioni, province, comuni - altrimenti scegliere qualcos'altro tipo $wpdb->prefix.'rpc_' | |
| define('PREFISSO_TABELLA', $prefisso); | |
| // Questione funzione crea e popola le tabelle necessarie nel db | |
| // Può essere agganciata come azione all'hook init nel functions.php, va caricato una volta sola e poi tolta dal file | |
| function rpc_crea_tabelle(){ | |
| global $wpdb; | |
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
| #################################################### | |
| # | |
| # MIMETYPES | |
| # | |
| #################################################### | |
| AddType video/mp4 mp4 m4v | |
| AddType audio/mp4 m4a | |
| AddType video/ogg ogv |
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 | |
| /* | |
| UPDATED: 23 Jan 2017. | |
| Modifications: | |
| - Truncated the longest country names, including: | |
| -- British Indian Ocean Territories (Chagos Archipelago) -> British Indian Ocean Territories | |
| -- South Georgia and the South Sandhich Islands -> South Georgia & S. Sandwich Islands |
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
| /* List of useful SQL queries */ | |
| SELECT * FROM wp_posts where post_type = 'shop_order' and post_status = 'wc-pending'; | |
| SELECT * FROM wp_posts where post_type = 'shop_order'; |