توی stackoverflow سوال کردم، جوابمو به همراه کد دادن
I want to put a text or html under the short product description Normally I can put any text in the short-description.php file But I want this text to be displayed only when my product has a Specia...
stackoverflow.com
موضوع حل شد
اما من یه چیزو متوجه نشدم
قبلا توی short-Description یک سری کد html گذاشته بودم که بعد از توضیحات کوتاه نمایش میداد
اما ظاهرا این کدی که من اضافه کردم جز short description نیست، و یا در انتهای توضیحات کوتاه میاد
من میخوام اون متنی که به کاربر هشدار میده باید ثبت نام کنه، دقیقا انتهایی ترین قسمت قرار بگیره
کد زیر، کد مربوط به short-description.php ووکامرسم هست
کد:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
global $post;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
if ( ! $short_description ) {
return;
}
?>
<div class="woocommerce-product-details__short-description">
<?php echo $short_description; // WPCS: XSS ok. ?>
</div>
<table class="table-fill">
<tbody class="table-hover">
<?php if ( get_field( 'platform' ) ): ?>
<tr>
<td class="text-left prd-platform ">Platform:</td>
<td class="text-left trd-platform">
<?php $terms = get_field('platform');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'version' ) ): ?>
<tr>
<td class="text-left prd-version">3DsMax Version:</td>
<td class="text-left trd-version">
<?php $terms = get_field('version');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'render' ) ): ?>
<tr>
<td class="text-left prd-render">Render:</td>
<td class="text-left trd-render"><?php $terms = get_field('render');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'format' ) ): ?>
<tr>
<td class="text-left prd-format">Format:</td>
<td class="text-left trd-format">
<?php $terms = get_field('format');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'size' ) ): ?>
<tr>
<td class="text-left prd-size">Size:</td>
<td class="text-left trd-size"><span class="acfcls"><?php the_field('size') ?></span> <span class="mbcls">MB</span></td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'date' ) ): ?>
<tr>
<td class="text-left prd-size">Date:</td>
<td class="text-left trd-size"><span class="acfcls"><?php the_field('date') ?></span></td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'material' ) ): ?>
<tr>
<td class="text-left prd-material">Material:</td>
<td class="text-left trd-material">
<?php $terms = get_field('material');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'style' ) ): ?>
<tr>
<td class="text-left prd-style">Style:</td>
<td class="text-left trd-style">
<?php $terms = get_field('style');
if( $terms ): ?>
<?php foreach( $terms as $term ): ?>
<a class="acflinkcls" href="<?php echo esc_url( get_term_link( $term ) ); ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if ( get_field( 'polygons' ) ): ?>
<tr>
<td class="text-left prd-size">Polygons:</td>
<td class="text-left trd-size"><span class="acfcls"><?php the_field('polygons') ?></span></td>
</tr>
<?php endif; ?>
</tbody>
</table>
توی کد بالا از قسمت <table> تا انتهای کد مربوط میشه به اضافاتی که به توضیحات کوتاه اضافه کردم، اما ظاهرا جای درستی نذاشتمش
توی همون تاپیک مربوط به stackoverflow هم توضیح دادم این مشکلو