Meta box Group with tags showing up twice in output

Support MB Group Meta box Group with tags showing up twice in outputResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38414
    Denise FieldDenise Field
    Participant

    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
    Output in Browser
    Here is the HTML source screenshot
    Output in Source Code

    #38415
    Denise FieldDenise Field
    Participant

    Sorry am having trouble getting the images to show up
    Here is the Browser Output

    Here is the Source Code

    #38416
    Denise FieldDenise Field
    Participant
    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>
    #38417
    Denise FieldDenise Field
    Participant

    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>
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.