Wednesday, May 18th, 2022

Topic Development – PHP Parse Error: syntax error, unexpected ‘end time’ (T_ENDWHILE), expecting else (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 124

Trying to help a friend move their website to a different host. The website works fine but when I move it I get the following error:

PHP parse error: syntax error, unexpected ‘end time’ (T_ENDWHILE), expecting else (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) in /home/servername.com/yjarzhhcad/public_html/wp-content/themes/ twentyninteen-child/single.php on line 124.

Her friend made this for her with the theme twenty first, you guys would have saved my life if you helped! I think it’s missing somewhere, but I can’t find it!

/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Nineteen
 * @since 1.0.0
 */

get_header();
?>


<section id="primary" class="content-area">
    <main id="main" class="site-main">

        <div class="post-repeat">
        <?php

        /* Start the Loop */
        while ( have_posts() ) :
        the_post(); 
        
        // Display post media ?>
        <div class="sunday-images">
            
        <?php if (has_post_format('video', $post->ID)) { ?>
            <?php
                
            // Video post
            $drive_id = get_post_meta( $post->ID, 'drive_id', true );
            $poster_id = get_post_meta( $post->ID, 'poster_image', true );
            $boomerang = get_post_meta( $post->ID, 'boomerang', true );
            // returns array
            $poster_image_attributes = wp_get_attachment_image_src ( $poster_id, 'large' );
            // video wrapper
            echo '<div class="videoWrapper ';
            if ($boomerang == 'true'){
                echo 'boomerang';
            }
            echo '">';
                // video thumbnail image
                echo '<video id="video" autoplay loop poster="' . $poster_image_attributes[0] . '">';
                // video file hosted on google drive
                echo '<source src="https://drive.google.com/uc?export=download&id=' . $drive_id . '" type="video/mp4">';
                echo '</video>';
            echo '</div>';

        } else { 
            
            // Not a video post
            if (get_the_post_thumbnail_url()) : ?>
                <img src="<?php echo get_the_post_thumbnail_url(); ?>"/>
            <? endif; 

            // if there is a gallery block do this
            if (has_block('gallery', $post->post_content)) {
                $post_blocks = parse_blocks($post->post_content);    
                foreach ($post_blocks as $block)
                {
                    if ($block['blockName'] == 'core/gallery')
                    {
                        foreach ($block['attrs']['ids'] as $id)
                        {
                            $src = wp_get_attachment_image_src($id, 'large')[0];
                            echo '<img src="' . $src . '" />';
                        }
                    }
                }

            } 
        }
        // Display episode number on image
        $count_posts = wp_count_posts();
        $published_posts = $count_posts->publish;

        echo '<div class="ep-num"><span>' . sos_get_episode_number($post->ID) . "</span> / " . $published_posts . "</div>";
        ?>

        
        
            
        </div><!-- .sunday-images -->
        
            
        <div class="content-toggle" id="<? echo $post->ID; ?>">
        <?php


            echo '<header class="title"><h1>' . get_the_title() . '</h1></header>';

            get_template_part( 'template-parts/content/content', 'single' );

            if ( is_singular( 'attachment' ) ) {
                // Parent post navigation.
                the_post_navigation(
                    array(
                        /* translators: %s: parent post link */
                        'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><span class="post-title">%s</span>', 'twentynineteen' ), '%title' ),
                    )
                );
            } elseif ( is_singular( 'post' ) ) {
                $prev_post_obj  = get_adjacent_post( '', '', true );
                $prev_post_ID   = isset( $prev_post_obj->ID ) ? $prev_post_obj->ID : '';
                $prev_post_link     = get_permalink( $prev_post_ID );
                $prev_post_title    = get_the_title($prev_post_ID);

                if ($prev_post_ID)
                { ?>
                <a href="<?php echo $prev_post_link; ?>" rel="previous" class="prev-post">
                    <?php echo $prev_post_title; ?>
                </a> <?php 
                }
                    // If comments are open or we have at least one comment, load up the comment template.
                    if ( comments_open() || get_comments_number() ) {

                        comments_template();
                    }     

                }

        endwhile; // End of the loop. ?>
        </div><!-- .content-toggle -->

    
        </div><!-- .post-repeat -->
    </main><!-- #main -->
        
        <div class="page-load-status">
            <div class="infinite-scroll-request">
                <div class="loader-wheel">
                  <i><i><i><i><i><i><i><i><i><i><i><i>
                  </i></i></i></i></i></i></i></i></i></i></i></i>
                </div>
            </div>
        </div>        
</section><!-- #primary -->

<?php
get_footer();

Source link