Вопрос

I think either I am quite stupid today or just work-blind by this project but I've been trying to fix a little error a new shortcode is causing.

This is the code

<?php function reviewslide_function() {
    $output .= '
    <!-- Review Injection -->
    <div id="reviews" class="p-full">
        <div class="section_head">
            <span class="eyebrow">You about us</span>
            <h2>Customer Reviews</h2>
        </div>
        <div class="stars">
            <span class="material-icons">grade</span>
            <span class="material-icons">grade</span>
            <span class="material-icons">grade</span>
            <span class="material-icons">grade</span>
            <span class="material-icons">grade</span>
        </div>
        <div id="reviewbox">';
    $args = array(
        'post_type' => 'review',
        'posts_per_page' => 5,
        'order' => 'DESC',
    );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    $output .= '
        <div class="review">'.
        the_content().
        '<span class="review_author">'. 
        bewerter_get_meta( "bewerter_name" ).
        '</span></div>';
    enwhile;
    $output .= '
    </div>
        <script>jQuery("#reviewbox > div:gt(0)").hide();
        
            setInterval(function() {
                jQuery("#reviewbox > div:first")
                .fadeOut(1800)
                .next()
                .fadeIn(2000)
                .end()
                .appendTo("#reviewbox");
            },  6000);
        </script>
        <div class="reviewbtn btn btn_blue arrow_r nosmooth">
            <a href="~GOOGLEREVIEWLINK~" target="_blank"><span>All Reviews</span></a>
        </div>
    </div>
    <!-- Review Exit -->';
    return $output;
}
add_shortcode('reviews', 'reviewslide_function'); ?>

This is the error thrown at me:

Parse error: syntax error, unexpected '}' in /html/wordpress-dev/wp-content/plugins/cpt-review/index.php on line 187

I am getting mad crazy trying to fix this, I just seem to be unable to find the error in here.

Это было полезно?

Решение

You have a typo in your code (enwhile instead of endwhile) so PHP is complaining because of non-closed while loop. Correct it and everything should be ok.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с wordpress.stackexchange
scroll top