✏️ 正在编辑: form-style-1.php
路径:
/home/h359620/public_html/wp-content/themes/datis/template-parts/comments/form-style-1.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php if (! defined('ABSPATH')) exit; $post_id = $args['post_id'] ?? get_the_ID(); if (! comments_open($post_id)) { return; } $is_product = (get_post_type($post_id) === 'product'); $commenter = wp_get_current_commenter(); $author_default = $commenter['comment_author'] ?? ''; $email_default = $commenter['comment_author_email'] ?? ''; // اگر $default_rating تعریف نشده بود خطا نده $default_rating = isset($default_rating) && $default_rating !== '' ? (float) $default_rating : 0; // ✅ برای ووکامرس باید name=rating باشد $rating_field_name = $is_product ? 'rating' : 'datis_rating'; ?> <div class="comment-form"> <div class="form-wrapper"> <form action="<?php echo esc_url(site_url('/wp-comments-post.php')); ?>" method="post" class="d-flex flex-column gap-4 align-items-end justify-content-between" id="commentform"> <div class="d-flex flex-column flex-lg-row gap-3 align-items-center justify-content-between"> <input type="text" name="author" class="coment-fullname" value="<?php echo esc_attr($author_default); ?>" placeholder="<?php echo esc_attr__('Full Name', 'datis'); ?>" <?php echo get_option('require_name_email') ? 'required' : ''; ?>> <input type="email" name="email" class="coment-email" value="<?php echo esc_attr($email_default); ?>" placeholder="<?php echo esc_attr__('Email', 'datis'); ?>" <?php echo get_option('require_name_email') ? 'required' : ''; ?>> <input type="text" name="datis_phone" class="coment-phone" placeholder="<?php echo esc_attr__('Phone Number', 'datis'); ?>"> </div> <div class="datis-rating" data-max="5"> <!-- ✅ فقط name عوض شد --> <input type="hidden" name="<?php echo esc_attr($rating_field_name); ?>" id="datis_rating" value="<?php echo esc_attr($default_rating); ?>"> <div class="datis-stars-ui" role="slider" aria-label="Rating" aria-valuemin="0" aria-valuemax="5" aria-valuenow="<?php echo esc_attr($default_rating); ?>" tabindex="0"> <div class="datis-stars-base"> <svg width="126" height="18" viewBox="0 0 126 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_714_3850)"> <path d="M10.5297 5.82902C8.68489 6.24642 7.76251 6.45511 7.54307 7.1608C7.32362 7.86648 7.95244 8.6018 9.21007 10.0724L9.53544 10.4529C9.89282 10.8708 10.0715 11.0798 10.1519 11.3383C10.2323 11.5968 10.2053 11.8756 10.1512 12.4332L10.102 12.9408C9.91191 14.9029 9.81684 15.884 10.3914 16.3202C10.9659 16.7563 11.8295 16.3587 13.5568 15.5634L14.0036 15.3576C14.4944 15.1316 14.7399 15.0186 15 15.0186C15.2601 15.0186 15.5056 15.1316 15.9964 15.3576L16.4432 15.5634C18.1705 16.3587 19.0341 16.7563 19.6086 16.3202C20.1832 15.884 20.0881 14.9029 19.898 12.9408M20.7899 10.0724C22.0476 8.6018 22.6764 7.86648 22.4569 7.1608C22.2375 6.45511 21.3151 6.24642 19.4703 5.82902L18.9931 5.72104C18.4689 5.60243 18.2068 5.54312 17.9963 5.38336C17.7858 5.22359 17.6509 4.98145 17.3809 4.49717L17.1351 4.05628C16.1851 2.35209 15.7101 1.5 15 1.5C14.2899 1.5 13.8149 2.35209 12.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip1_714_3850)"> <path d="M34.5297 5.82902C32.6849 6.24642 31.7625 6.45511 31.5431 7.1608C31.3236 7.86648 31.9524 8.6018 33.2101 10.0724L33.5354 10.4529C33.8928 10.8708 34.0715 11.0798 34.1519 11.3383C34.2323 11.5968 34.2053 11.8756 34.1512 12.4332L34.102 12.9408C33.9119 14.9029 33.8168 15.884 34.3914 16.3202C34.9659 16.7563 35.8295 16.3587 37.5568 15.5634L38.0036 15.3576C38.4944 15.1316 38.7399 15.0186 39 15.0186C39.2601 15.0186 39.5056 15.1316 39.9964 15.3576L40.4432 15.5634C42.1705 16.3587 43.0341 16.7563 43.6086 16.3202C44.1832 15.884 44.0881 14.9029 43.898 12.9408M44.7899 10.0724C46.0476 8.6018 46.6764 7.86648 46.4569 7.1608C46.2375 6.45511 45.3151 6.24642 43.4703 5.82902L42.9931 5.72104C42.4689 5.60243 42.2068 5.54312 41.9963 5.38336C41.7858 5.22359 41.6509 4.98145 41.3809 4.49717L41.1351 4.05628C40.1851 2.35209 39.7101 1.5 39 1.5C38.2899 1.5 37.8149 2.35209 36.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip2_714_3850)"> <path d="M58.5297 5.82902C56.6849 6.24642 55.7625 6.45511 55.5431 7.1608C55.3236 7.86648 55.9524 8.6018 57.2101 10.0724L57.5354 10.4529C57.8928 10.8708 58.0715 11.0798 58.1519 11.3383C58.2323 11.5968 58.2053 11.8756 58.1512 12.4332L58.102 12.9408C57.9119 14.9029 57.8168 15.884 58.3914 16.3202C58.9659 16.7563 59.8295 16.3587 61.5568 15.5634L62.0036 15.3576C62.4944 15.1316 62.7399 15.0186 63 15.0186C63.2601 15.0186 63.5056 15.1316 63.9964 15.3576L64.4432 15.5634C66.1705 16.3587 67.0341 16.7563 67.6086 16.3202C68.1832 15.884 68.0881 14.9029 67.898 12.9408M68.7899 10.0724C70.0476 8.6018 70.6764 7.86648 70.4569 7.1608C70.2375 6.45511 69.3151 6.24642 67.4703 5.82902L66.9931 5.72104C66.4689 5.60243 66.2068 5.54312 65.9963 5.38336C65.7858 5.22359 65.6509 4.98145 65.3809 4.49717L65.1351 4.05628C64.1851 2.35209 63.7101 1.5 63 1.5C62.2899 1.5 61.8149 2.35209 60.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip3_714_3850)"> <path d="M82.5297 5.82902C80.6849 6.24642 79.7625 6.45511 79.5431 7.1608C79.3236 7.86648 79.9524 8.6018 81.2101 10.0724L81.5354 10.4529C81.8928 10.8708 82.0715 11.0798 82.1519 11.3383C82.2323 11.5968 82.2053 11.8756 82.1512 12.4332L82.102 12.9408C81.9119 14.9029 81.8168 15.884 82.3914 16.3202C82.9659 16.7563 83.8295 16.3587 85.5568 15.5634L86.0036 15.3576C86.4944 15.1316 86.7399 15.0186 87 15.0186C87.2601 15.0186 87.5056 15.1316 87.9964 15.3576L88.4432 15.5634C90.1705 16.3587 91.0341 16.7563 91.6086 16.3202C92.1832 15.884 92.0881 14.9029 91.898 12.9408M92.7899 10.0724C94.0476 8.6018 94.6764 7.86648 94.4569 7.1608C94.2375 6.45511 93.3151 6.24642 91.4703 5.82902L90.9931 5.72104C90.4689 5.60243 90.2068 5.54312 89.9963 5.38336C89.7858 5.22359 89.6509 4.98145 89.3809 4.49717L89.1351 4.05628C88.1851 2.35209 87.7101 1.5 87 1.5C86.2899 1.5 85.8149 2.35209 84.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip4_714_3850)"> <path d="M106.53 5.82902C104.685 6.24642 103.763 6.45511 103.543 7.1608C103.324 7.86648 103.952 8.6018 105.21 10.0724L105.535 10.4529C105.893 10.8708 106.072 11.0798 106.152 11.3383C106.232 11.5968 106.205 11.8756 106.151 12.4332L106.102 12.9408C105.912 14.9029 105.817 15.884 106.391 16.3202C106.966 16.7563 107.83 16.3587 109.557 15.5634L110.004 15.3576C110.494 15.1316 110.74 15.0186 111 15.0186C111.26 15.0186 111.506 15.1316 111.996 15.3576L112.443 15.5634C114.17 16.3587 115.034 16.7563 115.609 16.3202C116.183 15.884 116.0881 14.9029 115.898 12.9408M116.79 10.0724C118.048 8.6018 118.676 7.86648 118.457 7.1608C118.237 6.45511 117.315 6.24642 115.47 5.82902L114.993 5.72104C114.469 5.60243 114.207 5.54312 113.996 5.38336C113.786 5.22359 113.651 4.98145 113.381 4.49717L113.135 4.05628C112.185 2.35209 111.71 1.5 111 1.5C110.29 1.5 109.815 2.35209 108.865 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <defs> <clipPath id="clip0_714_3850"> <rect x="6" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip1_714_3850"> <rect x="30" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip2_714_3850"> <rect x="54" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip3_714_3850"> <rect x="78" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip4_714_3850"> <rect x="102" width="18" height="18" rx="5" fill="white"></rect> </clipPath> </defs> </svg> </div> <div class="datis-stars-fill" aria-hidden="true"> <svg width="126" height="18" viewBox="0 0 126 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <g clip-path="url(#clip0_714_3850)"> <path d="M10.5297 5.82902C8.68489 6.24642 7.76251 6.45511 7.54307 7.1608C7.32362 7.86648 7.95244 8.6018 9.21007 10.0724L9.53544 10.4529C9.89282 10.8708 10.0715 11.0798 10.1519 11.3383C10.2323 11.5968 10.2053 11.8756 10.1512 12.4332L10.102 12.9408C9.91191 14.9029 9.81684 15.884 10.3914 16.3202C10.9659 16.7563 11.8295 16.3587 13.5568 15.5634L14.0036 15.3576C14.4944 15.1316 14.7399 15.0186 15 15.0186C15.2601 15.0186 15.5056 15.1316 15.9964 15.3576L16.4432 15.5634C18.1705 16.3587 19.0341 16.7563 19.6086 16.3202C20.1832 15.884 20.0881 14.9029 19.898 12.9408M20.7899 10.0724C22.0476 8.6018 22.6764 7.86648 22.4569 7.1608C22.2375 6.45511 21.3151 6.24642 19.4703 5.82902L18.9931 5.72104C18.4689 5.60243 18.2068 5.54312 17.9963 5.38336C17.7858 5.22359 17.6509 4.98145 17.3809 4.49717L17.1351 4.05628C16.1851 2.35209 15.7101 1.5 15 1.5C14.2899 1.5 13.8149 2.35209 12.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip1_714_3850)"> <path d="M34.5297 5.82902C32.6849 6.24642 31.7625 6.45511 31.5431 7.1608C31.3236 7.86648 31.9524 8.6018 33.2101 10.0724L33.5354 10.4529C33.8928 10.8708 34.0715 11.0798 34.1519 11.3383C34.2323 11.5968 34.2053 11.8756 34.1512 12.4332L34.102 12.9408C33.9119 14.9029 33.8168 15.884 34.3914 16.3202C34.9659 16.7563 35.8295 16.3587 37.5568 15.5634L38.0036 15.3576C38.4944 15.1316 38.7399 15.0186 39 15.0186C39.2601 15.0186 39.5056 15.1316 39.9964 15.3576L40.4432 15.5634C42.1705 16.3587 43.0341 16.7563 43.6086 16.3202C44.1832 15.884 44.0881 14.9029 43.898 12.9408M44.7899 10.0724C46.0476 8.6018 46.6764 7.86648 46.4569 7.1608C46.2375 6.45511 45.3151 6.24642 43.4703 5.82902L42.9931 5.72104C42.4689 5.60243 42.2068 5.54312 41.9963 5.38336C41.7858 5.22359 41.6509 4.98145 41.3809 4.49717L41.1351 4.05628C40.1851 2.35209 39.7101 1.5 39 1.5C38.2899 1.5 37.8149 2.35209 36.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip2_714_3850)"> <path d="M58.5297 5.82902C56.6849 6.24642 55.7625 6.45511 55.5431 7.1608C55.3236 7.86648 55.9524 8.6018 57.2101 10.0724L57.5354 10.4529C57.8928 10.8708 58.0715 11.0798 58.1519 11.3383C58.2323 11.5968 58.2053 11.8756 58.1512 12.4332L58.102 12.9408C57.9119 14.9029 57.8168 15.884 58.3914 16.3202C58.9659 16.7563 59.8295 16.3587 61.5568 15.5634L62.0036 15.3576C62.4944 15.1316 62.7399 15.0186 63 15.0186C63.2601 15.0186 63.5056 15.1316 63.9964 15.3576L64.4432 15.5634C66.1705 16.3587 67.0341 16.7563 67.6086 16.3202C68.1832 15.884 68.0881 14.9029 67.898 12.9408M68.7899 10.0724C70.0476 8.6018 70.6764 7.86648 70.4569 7.1608C70.2375 6.45511 69.3151 6.24642 67.4703 5.82902L66.9931 5.72104C66.4689 5.60243 66.2068 5.54312 65.9963 5.38336C65.7858 5.22359 65.6509 4.98145 65.3809 4.49717L65.1351 4.05628C64.1851 2.35209 63.7101 1.5 63 1.5C62.2899 1.5 61.8149 2.35209 60.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip3_714_3850)"> <path d="M82.5297 5.82902C80.6849 6.24642 79.7625 6.45511 79.5431 7.1608C79.3236 7.86648 79.9524 8.6018 81.2101 10.0724L81.5354 10.4529C81.8928 10.8708 82.0715 11.0798 82.1519 11.3383C82.2323 11.5968 82.2053 11.8756 82.1512 12.4332L82.102 12.9408C81.9119 14.9029 81.8168 15.884 82.3914 16.3202C82.9659 16.7563 83.8295 16.3587 85.5568 15.5634L86.0036 15.3576C86.4944 15.1316 86.7399 15.0186 87 15.0186C87.2601 15.0186 87.5056 15.1316 87.9964 15.3576L88.4432 15.5634C90.1705 16.3587 91.0341 16.7563 91.6086 16.3202C92.1832 15.884 92.0881 14.9029 91.898 12.9408M92.7899 10.0724C94.0476 8.6018 94.6764 7.86648 94.4569 7.1608C94.2375 6.45511 93.3151 6.24642 91.4703 5.82902L90.9931 5.72104C90.4689 5.60243 90.2068 5.54312 89.9963 5.38336C89.7858 5.22359 89.6509 4.98145 89.3809 4.49717L89.1351 4.05628C88.1851 2.35209 87.7101 1.5 87 1.5C86.2899 1.5 85.8149 2.35209 84.8649 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <g clip-path="url(#clip4_714_3850)"> <path d="M106.53 5.82902C104.685 6.24642 103.763 6.45511 103.543 7.1608C103.324 7.86648 103.952 8.6018 105.21 10.0724L105.535 10.4529C105.893 10.8708 106.072 11.0798 106.152 11.3383C106.232 11.5968 106.205 11.8756 106.151 12.4332L106.102 12.9408C105.912 14.9029 105.817 15.884 106.391 16.3202C106.966 16.7563 107.83 16.3587 109.557 15.5634L110.004 15.3576C110.494 15.1316 110.74 15.0186 111 15.0186C111.26 15.0186 111.506 15.1316 111.996 15.3576L112.443 15.5634C114.17 16.3587 115.034 16.7563 115.609 16.3202C116.183 15.884 116.0881 14.9029 115.898 12.9408M116.79 10.0724C118.048 8.6018 118.676 7.86648 118.457 7.1608C118.237 6.45511 117.3151 6.24642 115.47 5.82902L114.993 5.72104C114.469 5.60243 114.207 5.54312 113.996 5.38336C113.786 5.22359 113.651 4.98145 113.381 4.49717L113.135 4.05628C112.185 2.35209 111.71 1.5 111 1.5C110.29 1.5 109.815 2.35209 108.865 4.05628" stroke="var(--datis-primary-color)" stroke-width="1.5" stroke-linecap="round"></path> </g> <defs> <clipPath id="clip0_714_3850"> <rect x="6" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip1_714_3850"> <rect x="30" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip2_714_3850"> <rect x="54" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip3_714_3850"> <rect x="78" width="18" height="18" rx="5" fill="white"></rect> </clipPath> <clipPath id="clip4_714_3850"> <rect x="102" width="18" height="18" rx="5" fill="white"></rect> </clipPath> </defs> </svg> </div> </div> <span class="datis-rating-number" id="datis_rating_number"><?php echo esc_html($default_rating); ?></span> </div> <textarea name="comment" id="comment" placeholder="<?php echo esc_attr__('Additional information', 'datis'); ?>" required></textarea> <input type="hidden" name="comment_post_ID" value="<?php echo (int) $post_id; ?>"> <input type="hidden" name="comment_parent" value="0"> <?php comment_id_fields($post_id); do_action('comment_form', $post_id); wp_nonce_field('comment_form_' . $post_id, 'datis_comment_nonce'); ?> <button type="submit" class="leave-comment"> <span> <?php echo esc_html__('Leave a Comment', 'datis'); ?></span> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M6 6H15M6 6V15M6 6L12.5 12.5M18 18L15.5 15.5" stroke="#F7F6FE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> </svg> </button> </form> </div> </div>
💾 保存文件
← 返回文件管理器