Senza categoria

.htaccess rimuove php e imposta versione

# Inizia la configurazione di PHP 8.2
<IfModule mime_module>
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-ea-php82
    </FilesMatch>
</IfModule>
# Finisce la configurazione di PHP 8.2

# Rimuovi l'estensione .php dagli URL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
# Inizia la configurazione di PHP 8.2
<IfModule mime_module>
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-alt-php82
    </FilesMatch>
</IfModule>
# Finisce la configurazione di PHP 8.2

# Rimuovi l'estensione .php dagli URL
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
Senza categoria

Traccia aggiornamenti manuali

// TRACCIA AGGIORNAMENTI MANUALI PLUGIN
add_action('upgrader_process_complete', function ($upgrader_object, $options) {
    if (
        $options['action'] === 'update' &&
        $options['type'] === 'plugin' &&
        !empty($options['plugins'])
    ) {
        // Percorso file log
        $log_file = WP_CONTENT_DIR . '/plugin_update_log.txt';

        foreach ($options['plugins'] as $plugin_path) {
            // Ottieni dati del plugin aggiornato
            $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);

            $plugin_name = $plugin_data['Name'] ?? $plugin_path;
            $plugin_version = $plugin_data['Version'] ?? 'N/D';
            $update_time = current_time('d/m/Y H:i:s');

            // Nuovo formato del log
            $log_line = "[$update_time] $plugin_name - versione $plugin_version\n";

            // Scrive nel file (append)
            file_put_contents($log_file, $log_line, FILE_APPEND | LOCK_EX);
        }
    }
}, 10, 2);
Senza categoria

CF7 stile ed extra

Stile da inserire su flatsome

.wpcf7 span.wpcf7-list-item {
    margin-left: 0;
    margin-right: 0px;
}


.wpcf7 .wpcf7-form-control-wrap {
    display: contents;
}

input.wpcf7-form-control.wpcf7-submit.has-spinner.button {
    display: table;
    margin: 0 auto !important;
}

Extra

Privacy Policy: [privacy-policy] il [_date] alle [_time]
IP: [_remote_ip]

<div>[acceptance privacy-policy]*Acconsenti alla <a href="https://www.iubenda.com/privacy-policy/891167" target="_blank">Privacy Policy</a></div>

Senza categoria

Flatsome – Update

Installare versione null e poi copiare in functions.php

// Add custom Theme Functions here
$site_url = get_site_url();

$domain_name = wp_parse_url($site_url, PHP_URL_HOST);

$update_option_data = array(
    'id'           => 'new_id_123456',
    'type'         => 'PUBLIC',
    'domain'       => $domain_name, // Set the domain to the current domain name
    'registeredAt' => '2021-07-18T12:51:10.826Z',
    'purchaseCode' => 'abcd1234-5678-90ef-ghij-klmnopqrstuv',
    'licenseType'  => 'Regular License',
    'errors'       => array(),
    'show_notice'  => false
);

update_option('flatsome_registration', $update_option_data, 'yes');
Senza categoria

EdiSES – SEOZoom

Va modificato il file in seozoom/templates/szdash.php

// ammissione.it

if (current_user_can('administrator') || current_user_can('gestori_edises') && $sz_punti) {

// blog.edises.it
if (current_user_can('administrator') || current_user_can('edises_staff') && $sz_punti) {

la differenza sta nel nome del gruppo che ho creato (mannaggia a me)

Senza categoria

ux_product_hook

inc/shortcodes/custom-product.php

// funzione errata

add_shortcode( 'ux_product_hook', function ( $atts ) {
	extract( shortcode_atts( array(
		'hook' => 'woocommerce_single_product_summary',
	), $atts ) );

	if ( ! is_product() ) {
		return null;
	}

	$hooks = [
		'woocommerce_before_single_product_summary',
		'woocommerce_single_product_summary',
		'woocommerce_after_single_product_summary',
		'flatsome_custom_single_product_1',
		'flatsome_custom_single_product_2',
		'flatsome_custom_single_product_3',
	];

	ob_start();

	if ( in_array( $hook, $hooks, true ) ) {
		do_action( $hook );
	}

	return ob_get_clean();
} );
// va sostituita con

add_shortcode( 'ux_product_hook', function ( $atts ) {
	extract( shortcode_atts( array(
		'hook' => 'woocommerce_single_product_summary',
	), $atts ) );

	if ( ! is_product() ) {
		return null;
	}

	ob_start();
	do_action( $hook );

	return ob_get_clean();
} );

Senza categoria

Aggiungere custom font Flatsome


function my_kirki_custom_fonts( $standard_fonts ) {
		$standard_fonts['Panton Narrow'] = array(
			'label'    => 'Panton Narrow - TMF',
			'variants' => array( '400', '700' ),
			'stack'    => 'panton_narrow-trialbold',
		);
		return $standard_fonts;
	}
	add_filter( 'kirki/fonts/standard_fonts', 'my_kirki_custom_fonts' );
	
	

inserire il css del font in style e convertire su fontsquirrel.com

@font-face {
    font-family: 'panton_narrow-trialbold';
    src: url('https://www.tmfcyclingpad.com/font/pantonnarrow-trial-bold-webfont.eot');
    src: url('https://www.tmfcyclingpad.com/font/pantonnarrow-trial-bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('https://www.tmfcyclingpad.com/font/pantonnarrow-trial-bold-webfont.woff2') format('woff2'),
         url('https://www.tmfcyclingpad.com/font/pantonnarrow-trial-bold-webfont.woff') format('woff'),
         url('https://www.tmfcyclingpad.com/font/pantonnarrow-trial-bold-webfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;

}
Senza categoria

Coupon – Edises

crea tabella con tutti i dati necessari

CREATE TABLE sconti_by_percent AS
SELECT
    sr.rule_id,
    sr.name AS rule_name,
    sr.description AS rule_description,
    sr.is_active AS rule_is_active,
    sr.simple_action,
    sr.conditions_serialized,
    sr.actions_serialized AS ACTION,
    sr.from_date,
    sr.to_date,
    sr.discount_amount,
    sr.uses_per_coupon,
    sr.uses_per_customer,
    src.coupon_id,
    src.code AS coupon_code,
    src.times_used AS coupon_times_used,
    src.expiration_date AS coupon_expiration_date
FROM
    salesrule sr
JOIN
    salesrule_coupon src ON sr.rule_id = src.rule_id
WHERE
    sr.simple_action = 'by_percent'
ORDER BY
    sr.rule_id;

sr.simple_action = by_percent, by_fixed, cart_fixed, ampromo_items

ALTER TABLE sconti_by_percent
ADD COLUMN attribute_value VARCHAR(255),
ADD COLUMN category_value TEXT;

--

UPDATE sconti_by_percent
SET attribute_value = JSON_UNQUOTE(JSON_EXTRACT(ACTION, '$.conditions[0].attribute')),
    category_value = JSON_UNQUOTE(JSON_EXTRACT(ACTION, '$.conditions[0].value'));

Per capire quanti coupon esistono per tipologia

SELECT
    simple_action,
    COUNT(*) AS rule_count
FROM
    salesrule
GROUP BY
    simple_action
ORDER BY
    rule_count DESC;

visualizzare la lista coupon, usare la clausula WHERE sr.simple_action = ” in combinazione con i risultati forniti dalla query precedente

SELECT
    sr.rule_id,
    sr.name AS rule_name,
    sr.description AS rule_description,
    sr.is_active AS rule_is_active,
    sr.simple_action,
    sr.conditions_serialized,
    src.coupon_id,
    src.code AS coupon_code,
    src.times_used AS coupon_times_used,
    src.expiration_date AS coupon_expiration_date
FROM
    salesrule sr
JOIN
    salesrule_coupon src ON sr.rule_id = src.rule_id
WHERE
    sr.simple_action = 'by_percent'
ORDER BY
    sr.rule_id;

Risorsa utile: https://chatgpt.com/c/bc009109-4fdc-4636-b64d-aa73a0796b9e

Estrarre entity_id dei vari attributi

SELECT attribute_value, COUNT(*) AS count
FROM sconti_by_percent
GROUP BY attribute_value;

In base alla regola che troviamo, ad esempio se hanno attributi, bisogna estrarli e trovare l’entity_id

SELECT entity_id 
FROM catalog_product_entity_int 
WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'disalsingoli' AND entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'))
AND value = 1;

trovato l’entity_id bisogna importare la regola, in caso di eb_eserc_sost_anief  sappiamo che c’è uno sconto del 100% uso per coupon 1 su entity_id 1358, quindi vanno presi tutti i codici coupon nella tabella sconti_by_percent nel campo_coupon_code