Обновление файла content-single-product.php правильно - PullRequest
0 голосов
/ 22 мая 2019

Я сделал страницу продуктов так, как будто хочу, чтобы она просматривала файл content-single-product.php, но она конфликтует с плагином.Я думаю, что, возможно, допустил ошибку или неэффективно закодировал, поэтому я добавляю здесь свою кодировку, чтобы посмотреть, как я могу ее улучшить, или мне следует сделать это другим способом

Я недавно обновил woocommerce и заметил, чтомое кодирование может быть не совсем подходящим для этой страницы.Я добавил несколько вещей, чтобы на странице одного продукта отображалось, как я хочу, но я думаю, что смогу сделать это по-другому.Ищу предложения по улучшению моего кода.Запуск php 7.2 wp 5.2.1 woocommerce 3.6.3.

`

   <?php
/**
 * The template for displaying product content in the single-product.php template
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates
 * @version 3.6.0
 */

defined( 'ABSPATH' ) || exit;

global $product;

/**
 * Hook: woocommerce_before_single_product.
 *
 * @hooked wc_print_notices - 10
 */
do_action( 'woocommerce_before_single_product' );

if ( post_password_required() ) {
    echo get_the_password_form(); // WPCS: XSS ok.
    return;
}
?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>


<div class="container-fluid">

    <!-- Breadcrumbs Start -->
        <!--<div class="row">
            <div class="col-sm-12 pb-4">
                <?php do_action( 'woocommerce_before_main_content' ); ?>
                <hr>
            </div>
        </div>-->
        <!-- Breadcrumbs End -->

        <!-- Images and product info -->
        <div class="row">

            <!-- Product Image and Sharing Start --> 
            <div class="col-lg-5 col-sm-12">
                <div class="row">
                    <div class="col-sm-12 text-center m-auto align-center w-100">
                        <?php do_action( 'woocommerce_before_single_product_summary' ); ?>
                    </div>
                      <div class="col-sm-12 "style="margin-top:3%;"">
                        <?php echo do_shortcode('[share title="Share this Product" facebook="true" linkedin="true" twitter="true" google_plus="False"  pinterest="false" reddit="false" email="true"]'); ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12"style="margin-top:3%;">
                        <?php do_action( 'woocommerce_single_product_summary_sharing' ); ?>
                    </div>
               </div>
            </div>
            <!-- Product Image and Sharing End -->

            <!-- Product Info Start -->
            <div class="col-lg-7 col-sm-12">
                <div class="row">
                    <div class="col-sm-12 mt-3">
                        <?php do_action( 'woocommerce_single_product_title' ); ?>
                        <hr>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_single_product_summary_meta'); ?>
                        <hr>
                    </div>
                    <div class="col-sm-12">
                        <?php do_action('woocommerce_single_product_summary_price'); ?>
                    </div>
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_single_product_summary_excerpt'); ?>
                    </div>
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_single_product_summary' ); ?>
                    </div>
                </div>
                <div class="row">

                </div>
                <div class="row">

                </div>
                <div class="row">
                    <div class="col-sm-8" style="margin-top:4%;">
                        <?php echo do_shortcode('[ti_wishlists_addtowishlist]'); ?>
                    </div>   
                </div>
            </div>
        </div>
                <div class="row">

                </div>

                    <!-- Product Info End -->





         <!-- Images and Product Info End -->

        <!-- Section Contact | Additional Information -->
        <div class="row py-4">
            <div class="col-lg-4 col-sm-12">
                <div class="p-3" style="border:solid thin #71a634; background: #FFFF; border-radius: 25px; margin-bottom: 2%;">
                            <center>
                        <p> <b>Cant find what you are looking for? Buying In Bulk or Large Orders ? </b></p><a class="x-btn btn-lg rounded" style="text-shadow:none;font-size:16px;" href="http://rodburn.com.au/get-a-quote">Request A Quote</a>
                            </center>
                </div>


                <div class="p-3" style="border:dashed thin #71a634;border-radius: 25px;">
                    <h4 class="text-green">Quick Product Information</h4>
                    <?php echo do_shortcode( '[contact-form-7 id="14448" title="Product Sidebar"]' ); ?>
                </div>
            </div>
            <div class="col-lg-8 col-sm-12">
                <div class="row">
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_after_single_product_summary_tabs' ); ?>
                    </div>
                </div>
            </div>
                <div class="row">
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_after_single_product_summary_upsell'); ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <?php do_action( 'woocommerce_after_single_product_summary_related' ); ?>
                    </div>
                </div>
            </div>
        </div>
        <!-- END Contact | Additional Information -->




</div>           

<?php do_action( 'woocommerce_after_single_product' ); ?>

`

У меня возникли проблемы с плагином под названием Product Inquiry Pro для WooCommerce, и PEP использует следующий selector.summary.entry-summary .variation_id:Первенец, я хотел бы иметь возможность использовать как мой макет, так и использовать плагин.Если я извлекаю файл, плагин работает, но я теряю свои модификации.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...