Skip to content

Instantly share code, notes, and snippets.

View fburatti's full-sized avatar

Filippo Buratti fburatti

View GitHub Profile
@fburatti
fburatti / bulk-regenerate-download-permissions.php
Created September 30, 2022 11:03
Bulk regenerate download permissions
<?php add_action( 'wp_ajax_ccom_regenerate', function() {
$offset = empty( $_POST['offset'] )
? 0 : intval( $_POST['offset'] );
$args = [
'status' => array('wc-completed'),
'type' => 'shop_order',
'limit' => 100,
'offset' => $offset,
];
a:5:{s:12:"pa_categoria";a:7:{s:4:"name";s:12:"pa_categoria";s:5:"value";s:7:"Orologi";s:8:"position";i:0;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:1;s:24:"is_create_taxonomy_terms";i:1;}s:13:"pa_collezione";a:7:{s:4:"name";s:13:"pa_collezione";s:5:"value";s:4:"Octo";s:8:"position";i:2;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:1;s:24:"is_create_taxonomy_terms";i:1;}s:9:"materiale";a:6:{s:4:"name";s:9:"Materiale";s:5:"value";s:8:"Ceramica";s:8:"position";i:3;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:0;}s:10:"dimensione";a:6:{s:4:"name";s:10:"Dimensione";s:5:"value";s:5:"40 MM";s:8:"position";i:4;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:0;}s:12:"pa_materiale";a:7:{s:4:"name";s:12:"pa_materiale";s:5:"value";s:8:"Ceramica";s:8:"position";i:3;s:10:"is_visible";i:1;s:12:"is_variation";i:1;s:11:"is_taxonomy";i:1;s:24:"is_create_taxonomy_terms";i:1;}}
@fburatti
fburatti / include-js.php
Created January 28, 2019 21:34
Open street map with ACF
function properties_map_script() {
wp_register_style(
'leaflet',
"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css",
array(),
null
);
wp_register_script(
@fburatti
fburatti / open-street-map-script.js
Last active March 28, 2024 13:48
Open street map with Leaflet.js
// leaflet.js required
// the properties array can contain multiple pointers (markers) and is included with wordpress wp_localize_script
//var properties = [{"title":"Some title","lat":"42.75410269263614","lng":"12.758049219846725","thumb":"http:\/\/www.mysite.ext\/wp-content\/uploads\/2016\/05\/image.jpg","url":"http:\/\/www.www.mysite.ext\/"}];
var map;
function render_map( $el ) {
var $markers = properties;
<?php
function modify_setefi_plugin_params( $value ) {
$value['currencyCode'] = '840';
return $value;
}
add_filter( 'wc_setefi_payment_args', 'modify_setefi_plugin_params' );
?>
@fburatti
fburatti / wpml-snippet.php
Created April 5, 2016 10:46
WooCommerce Multilingual (wpml) integration for woocommerce setefi monetaweb
<?php
function modify_setefi_plugin_params( $value ) {
// consente di impostare la lingua della pagina di pagamento sul server della banca in base alla lingua corrente nello shop
/*if( ICL_LANGUAGE_CODE == 'it' ) {
$value['language'] = 'ITA';
} else if (ICL_LANGUAGE_CODE == 'en') {
$value['language'] = 'USA';
} */
<?php
add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_receipt_number', 10, 2 );
function wpo_wcpdf_receipt_number ($template_type, $order) {
global $wpo_wcpdf;
if ($template_type == 'receipt') {
// get number from order
$receipt_number = get_post_meta( $order->id, 'Receipt Number', true );
// get number from database if no number present yet
if (empty($receipt_number)) {
$receipt_number = get_option( 'wcpdf_next_receipt_number', 1001 ); // change 1001 to define the first number
@fburatti
fburatti / province.php
Created December 8, 2015 16:42 — forked from wgh000/province.php
Province Italia - Array PHP
<?php
$province = array(
'AG' => 'Agrigento',
'AL' => 'Alessandria',
'AN' => 'Ancona',
'AO' => 'Aosta',
'AR' => 'Arezzo',
'AP' => 'Ascoli Piceno',
'AT' => 'Asti',
'AV' => 'Avellino',
function qtranxf_custom_language_chooser($style='', $id='') {
global $q_config;
if($style=='') $style='text';
if(is_bool($style)&&$style) $style='image';
if(is_404()) $url = get_option('home'); else $url = '';
if($id=='') $id = 'qtranslate';
$id .= '-chooser';
$flag_location=qtranxf_flag_location();
switch($style) {
case 'image':
@fburatti
fburatti / gist:10056057
Created April 7, 2014 21:06
Add Twitter Bootstrap 3 markup to Yoast Breadcrumbs
/*
*
* Add Twitter Bootstrap 3 markup to Yoast Breadcrumbs
*
*/
add_filter( 'wpseo_breadcrumb_output_wrapper', 'my_breadcrumbs_wrapper', 10, 1 );
add_filter( 'wpseo_breadcrumb_output_class', 'my_breadcrumbs_wrapper_class', 10, 1 );
add_filter( 'wpseo_breadcrumb_single_link_wrapper', 'my_breadcrumbs_wrapper_element', 10, 1 );
function my_breadcrumbs_wrapper($wrapper){