This file contains 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
jQuery( function( $ ) { | |
var cities = wc_city_dropdown.cities; | |
wrapper_selectors = '.woocommerce-billing-fields,' + | |
'.woocommerce-shipping-fields,' + | |
'.woocommerce-address-fields'; | |
$( document.body ).on( 'change refresh', 'select.country_to_state, input.country_to_state', function() { | |
var $wrapper = $( this ).closest( wrapper_selectors ); |
This file contains 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 | |
/** | |
* Plugin Name: Static Templates | |
* | |
* If most of your site content is in .php template files, and you're tired of | |
* creating new pages, assigning them page templates, creating page templates | |
* then doing it all over again on production, this plugin is for you. | |
* | |
* Examples: | |
* |
This file contains 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 | |
// don't copy above line when copying and pasting into your functions.php | |
// Remove WP version number from js and css files. | |
// more exact function, removes also "&" | |
function remove_cssjs_ver( $src ) { | |
if( strpos( $src, '?ver=' ) || strpos( $src, '&ver=' ) ) | |
$src = remove_query_arg( 'ver', $src ); |
This file contains 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 is the cleaner code per request of a thread in the LinkedIn group "WordPress" | |
// ... | |
// register and enqueue loadCSS | |
function load_scripts_and_styles() { | |
// register loadCSS | |
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false ); |
This file contains 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
#WP block - see https://fr.wordpress.org/support/article/htaccess/ | |
RewriteEngine On | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
# ajouter un slash après /wp-admin | |
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] | |
RewriteCond %{REQUEST_FILENAME} -f [OR] |
This file contains 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 | |
// Action Hook to add column value for posts | |
add_action( 'manage_posts_custom_column' , 'your_function', 10, 2 ); |
This file contains 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 | |
/** | |
* Enqueues the css and js required by the Image Crop. | |
*/ | |
function blp_core_cover_image_scripts() { | |
wp_enqueue_script( 'jcrop', array( 'jquery' ) ); | |
wp_enqueue_script( 'plupload', array(), false, false ); | |
wp_enqueue_style( 'jcrop' ); | |
} |
This file contains 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
jQuery(document).ready(function() { | |
jQuery(document.body).on('change', 'input[name="payment_method"]', function() { | |
jQuery('body').trigger('update_checkout'); | |
}); | |
}); |
This file contains 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
function ajx_sharpen_resized_files( $resized_file ) { | |
$image = wp_load_image( $resized_file ); | |
if ( !is_resource( $image ) ) | |
return new WP_Error( 'error_loading_image', $image, $file ); | |
$size = @getimagesize( $resized_file ); | |
if ( !$size ) | |
return new WP_Error('invalid_image', __('Could not read image size'), $file); | |
list($orig_w, $orig_h, $orig_type) = $size; |
This file contains 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 | |
class My_Favorite_Director_Widget extends WP_Widget | |
{ | |
function __construct() | |
{ | |
$widget_details = array( | |
'classname' => 'my-favorite-director-widget', | |
'description' => 'Display movies from your favorite director.' | |
); |
NewerOlder