dimanche 30 décembre 2018

Unexpected end of file error afterv adding if else statement to my WordPress content template

I've been looking at various examples of SO on how to solve this but no luck yet. Basically, I wanted to add an if else statement to my WordPress content template, which was fine previously, but now I get an Unexpected end of file message and I'm stumped as to where that might be. This is the original code:

<div class="entry-content">
    <?php 
        the_content( sprintf(
        wp_kses(
            __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'mytheme' ),
            array(
                'span' => array(
                    'class' => array(),
                ),
            )
        ),
        get_the_title()
    ) );

    echo '<p class="btn-cc"><a href="%s" rel="bookmark">Read More</a></p>';

    wp_link_pages( array(
        'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'mytheme' ),
        'after'  => '</div>',
    ) );

    ?>
</div>

and this is what I did to it.

<div class="entry-content">
    <?php if ( is_category() || is_archive() ) {
        the_excerpt('');
            } else {
        the_content( sprintf(
        wp_kses(
            __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'mytheme' ),
            array(
                'span' => array(
                    'class' => array(),
                ),
            )
        ),
        get_the_title()
    ) );

    echo '<p class="btn-cc"><a href="%s" rel="bookmark">Read More</a></p>';

    wp_link_pages( array(
        'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'mytheme' ),
        'after'  => '</div>',
    ) );

    ?>
</div>

So where did I make a mistake?

Aucun commentaire:

Enregistrer un commentaire