在插件功能中更改图像

时间:2019-01-31 06:26:57

标签: wordpress

我想更改此插件中的图像,这样就不必每次更新都覆盖它。有没有简单的方法可以做到这一点?这是我指的功能。我将不得不将路径更改为'/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
        }
    }

0 个答案:

没有答案