Parse Error: unexpected '}' while creating Shortcode with Loop

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=eyebrowYou about us/span
            h2Customer Reviews/h2
        /div
        div class=stars
            span class=material-iconsgrade/span
            span class=material-iconsgrade/span
            span class=material-iconsgrade/span
            span class=material-iconsgrade/span
            span class=material-iconsgrade/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
        scriptjQuery(#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=_blankspanAll 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.

Topic parse shortcode Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.