首页 > 解决方案 > 在插件功能中更改图像

问题描述

我想更改此插件中的图像,这样我就不必在每次更新时都覆盖它。有什么简单的方法可以做到这一点吗?这是我所指的功能。我将不得不更改'/images/delivery.svg'图像的路径。谢谢!

    public function show_picked_up_icon( $order, $css_class = '' ) {

        if ( ! $this->is_order_shipped( $order ) ) {
            return;
        }

        $order_id = yit_get_prop( $order, 'id' );

        $track_css_class = "button track-button order-" . $order_id;
        if ( ! empty( $css_class ) ) {
            $track_css_class .= " " . $css_class;
        }

        $message = $this->get_picked_up_message( $order );

        $track_url = $this->get_track_url( $order );
        if ( strlen( $track_url ) == 0 ) {
            $message   = __( "Track url not found.", 'yith-woocommerce-order-tracking' ) . $message;
            $track_url = '#';
        }

        echo '<a class="' . $track_css_class . '" href="' . $track_url . '" target="_blank" data-title="' . $message . '">';
        echo '<img class="track-icon track-button" src="' . apply_filters( 'yith_ywot_track_button_url', YITH_YWOT_ASSETS_URL . '/images/delivery.svg' ) . '" data-title="' . $message . '" />';

        if ( ! is_admin() ) {
            _e( 'Track', 'yith-woocommerce-order-tracking' );
        }

        echo '</a>';

        //  If the carrier website use a form to track shipment, add a hidden form under the button

        $track_form = $this->get_tracking_post_form( $order );
        $data       = YITH_Tracking_Data::get( $order );

        if ( ! empty( $track_form ) ) {
            // Append a form to be used for post data to carrier web site
            ?>
            <script type="text/javascript">
                jQuery(document).on("click", "a.track-button.order-<?php echo $order_id; ?>", (function (e) {
                    e.preventDefault();

                    jQuery("body").append('<?php echo str_replace( "\n", "\\", $track_form ); ?>');
                    jQuery("form[name='<?php echo $data->get_carrier_id(); ?>']").submit();
                    jQuery("form[name='<?php echo $data->get_carrier_id(); ?>']").remove();
                }));
            </script>
            <?php
        }
    }

标签: wordpress

解决方案


推荐阅读