WPML Coding API
http://wpml.org/documentation/support/wpml-coding-api/
| SNIPPET | COMMENTS |
| /* | |
| * WP Instagram Feed | |
| * | |
| * To get a new Access Token, change the [], put it in the browser and it will return with your token in the next URL. | |
| * https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URL]&response_type=token | |
| *********************************************************************/ | |
| function wp_instagram_feed($count = 20) { | |
| $slug = "instagram_feed_self"; | |
| $access_token = '[ACCESS_TOKEN_HERE]'; | |
| # SELECT any post_status | |
| SELECT meta_value,COUNT(meta_value),GROUP_CONCAT(DISTINCT post_id ORDER BY post_id SEPARATOR ',') post_id | |
| FROM wp_postmeta | |
| WHERE meta_key = '_sku' | |
| AND meta_value != '' | |
| GROUP BY meta_value HAVING COUNT(meta_value) > 1 | |
| # SELECT only from products that are already published or in draft | |
| SELECT meta_value,COUNT(meta_value),GROUP_CONCAT(DISTINCT post_id ORDER BY post_id SEPARATOR ',') post_id | |
| FROM wp_postmeta |
WPML Coding API
http://wpml.org/documentation/support/wpml-coding-api/
| SNIPPET | COMMENTS |
| /** | |
| * Scan Gravity Forms uploads with ClamAV | |
| * Based on 'Custom Scan AV function by Kris Chase' | |
| * https://krischase.com/detect-and-prevent-malware-in-gravity-forms-file-upload-with-php-clamav/ | |
| * Requires clamav and php-clamav installed and enabled | |
| */ | |
| function myfunc_uploads_clamav( $validation_result ) { | |
| if ( $_FILES ) { | |
| $form = $validation_result['form']; |
| <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> | |
| <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> | |
| <link rel="icon" type="image/png" sizes="36x36" href="/android-chrome-36x36.png"> | |
| <link rel="icon" type="image/png" sizes="48x48" href="/android-chrome-48x48.png"> | |
| <link rel="icon" type="image/png" sizes="72x72" href="/android-chrome-72x72.png"> | |
| <link rel="icon" type="image/png" sizes="96x96" href="/android-chrome-96x96.png"> | |
| <link rel="icon" type="image/png" sizes="144x144" href="/android-chrome-144x144.png"> | |
| <link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png"> | |
| <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"> | |
| <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"> |
| <?php | |
| class My_Custom_My_Account_Endpoint { | |
| /** | |
| * Custom endpoint name. | |
| * | |
| * @var string | |
| */ | |
| public static $endpoint = 'my-custom-endpoint'; |
| # BEGIN WordPress | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{HTTP_HOST} ^local.site\.com$ | |
| RewriteRule ^wp-content/uploads/(.*)$ https://production.site.com/wp-content/uploads/$1 [NC,L] |
| <?php | |
| add_filter( 'rest_authentication_errors', function( $result ) { | |
| if ( ! empty( $result ) ) { | |
| return $result; | |
| } | |
| if ( ! is_user_logged_in() ) { | |
| return new WP_Error( 'restx_logged_out', 'Sorry, you must be logged in to make a request.', array( 'status' => 401 ) ); | |
| } | |
| return $result; |
| #!/bin/bash | |
| DATABASE_PATH="data/plugins.json" | |
| SYMBOL="[!]" | |
| TMPFILE="output.tmp" | |
| declare -A WEBSITES | |
| # List your WordPress websites here | |
| WEBSITES['www.website1.dom']='address1@server1.com,address2@server2.com' | |
| WEBSITES['www.website2.dom']='address2@server1.com,address3@server2.com' |
| /*globals wpml_browser_redirect_params */ | |
| jQuery(document).ready(function () { | |
| if (jQuery.cookie !== undefined) { | |
| // Check if cookie are enabled | |
| jQuery.cookie('wpml_browser_redirect_test', '1'); | |
| var cookie_enabled = jQuery.cookie('wpml_browser_redirect_test') === '1'; | |
| jQuery.removeCookie('wpml_browser_redirect_test'); | |
| if (cookie_enabled) { |