• Hi everyone,

    When I modify the content.php to show “the_excerpt” instead of “the_content” in my front page, the site fails the google mobile optimization test.

    Do you know what’s wrong?

    In content.php I changed this:

    <div class="entry-content">
    		<?php
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
     
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    		?>
    	</div><!-- .entry-content -->

    For this:

    <div class="entry-content">
    		<?php
    if ( is_single() ) :
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
     
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    else :
     
    /* translators: %s: Name of current post */
    			the_excerpt( sprintf(
    				__( 'Continue reading %s', 'twentyfifteen' ),
    				the_title( '<span class="screen-reader-text">', '</span>', false )
    			) );
     
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    endif;
     
    		?>
    	</div><!-- .entry-content -->
    • This topic was modified 6 years, 4 months ago by oceanmind.

    The page I need help with: [log in to see the link]

  • The topic ‘Mobile optimization test fails when using excerpt in front page’ is closed to new replies.