Plugin Directory

Changeset 2644453


Ignore:
Timestamp:
12/15/2021 10:47:58 AM (4 years ago)
Author:
thomascharbit
Message:

fix polylang/wpml integration

Location:
wc-shipping-method-description/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wc-shipping-method-description/trunk/readme.txt

    r2635793 r2644453  
    55Tested up to: 5.8
    66Requires PHP: 5.3
    7 Stable tag: 1.2.0
     7Stable tag: 1.2.1
    88License: GPLv3 or later License
    99WC requires at least: 2.6
     
    2828== Changelog ==
    2929
     30= 1.2.1 =
     31* Fix: Polylang/WPML integration not working
     32
    3033= 1.2.0 =
    3134* Feature: allow HTML tags in description
  • wc-shipping-method-description/trunk/shipping-method-description-for-woocommerce.php

    r2635793 r2644453  
    66 * Author: Thomas Charbit
    77 * Author URI: https://thomascharbit.fr
    8  * Version: 1.2.0
     8 * Version: 1.2.1
    99 * License: GPLv3 or later License
    1010 * Requires at least: 4.4
     
    3232add_action( 'init', 'smdfw_init', 100 );
    3333function smdfw_init() {
     34    // Add shipping methods filters
     35    $shipping_methods = WC()->shipping->get_shipping_methods();
     36    foreach ( $shipping_methods as $id => $shipping_method ) {
     37        add_filter( "woocommerce_shipping_instance_form_fields_$id", 'smdfw_add_form_fields' );
     38    }
    3439    // Add Polylang integration if needed
    3540    if ( function_exists( 'pll_current_language' ) ) {
     
    3944    if ( function_exists( 'icl_object_id' ) && ! function_exists( 'pll_current_language' ) ) {
    4045        require_once SMDFW_DIR . 'includes/smdfw-wpml.php';
    41     }
    42 
    43     // Add shipping methods filters
    44     $shipping_methods = WC()->shipping->get_shipping_methods();
    45     foreach ( $shipping_methods as $id => $shipping_method ) {
    46         add_filter( "woocommerce_shipping_instance_form_fields_$id", 'smdfw_add_form_fields' );
    4746    }
    4847}
     
    9695    if ( array_key_exists( 'description', $meta_data ) ) {
    9796        $description = apply_filters( 'smdfw_description_output', html_entity_decode( $meta_data['description'] ), $method );
    98         $html        = '<div><small class="smdfw">' . wp_kses( $description, wp_kses_allowed_html( 'post' ) ) . '</small></div>';
     97        $html        = '<div><small class="smdfw">' .  wp_kses( $description, wp_kses_allowed_html( 'post' ) ) . '</small></div>';
    9998        echo apply_filters( 'smdfw_description_output_html', $html, $description, $method );
    10099    }
Note: See TracChangeset for help on using the changeset viewer.