Support Forum
Support › Meta Box Group › Meta box Group with tags showing up twice in outputResolved
Hi
I am creating a custom product page on Woocommerce Products. In that layout I have a Metabox that adds bullet points, each bullet point is wrapped in <li></li>
tags, set up in the advanced tab on the field creation.
But the output is showing twice, the first one has been duplicated by woocommerce, but its definitely not my code as I gave the <UL>
tag a class and the first one has none.
Any Ideas
Here is the code I added to the woocommerce short description file
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
global $post;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
if ( ! $short_description )
return;
// Bullet Points
$bullet_points = '<ul class="product__short-description--bullets">' . rwmb_the_value( "product_bullet_point" ) . '</ul>';
// The custom text
$custom_text = '<ul class="product__short-description--bullets--red">
<li>Please see our <a href="https://www.pinkequine.com/buyers-guide/">Buyers Guide</a> for current delivery times on Bespoke Products</li>
</ul>';
?>
<div class="product__short-description">
<?php echo $short_description . $bullet_points . $custom_text ; // WPCS: XSS ok. ?>
</div>
Here is the output screenshot
Here is the HTML source screenshot
Sorry am having trouble getting the images to show up
Here is the Browser Output
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
global $post;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
if ( ! $short_description )
return;
// Bullet Points
$bullet_points = '<ul class="product__short-description--bullets">' . rwmb_the_value( "product_bullet_point" ) . '</ul>';
// The custom text
$custom_text = '<ul class="product__short-description--bullets--red">
<li>Please see our <a href="https://www.pinkequine.com/buyers-guide/">Buyers Guide</a> for current delivery times on Bespoke Products</li>
</ul>';
?>
<div class="product__short-description">
<?php echo $short_description . $bullet_points . $custom_text ; // WPCS: XSS ok. ?>
</div>
Ok I solved it myself, I was using the wrong code snippet
I used this and it worked
<?php $values = rwmb_meta( 'my_field_id' ); ?>
<ul>
<?php foreach ( $values as $value ) : ?>
<li><?= $value ?></li>
<?php endforeach ?>
</ul>