These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * The main template file. |
||
4 | * |
||
5 | * This is the most generic template file in a WordPress theme |
||
6 | * and one of the two required files for a theme (the other being style.css). |
||
7 | * It is used to display a page when nothing more specific matches a query. |
||
8 | * E.g., it puts together the home page when no home.php file exists. |
||
9 | * Learn more: http://codex.wordpress.org/Template_Hierarchy |
||
10 | * |
||
11 | * @package spurs |
||
12 | */ |
||
13 | |||
14 | // Exit if accessed directly. |
||
15 | defined( 'ABSPATH' ) || exit; |
||
16 | View Code Duplication | if ( have_posts() ) : while ( have_posts() ) : the_post(); |
|
0 ignored issues
–
show
|
|||
17 | |||
18 | /* |
||
19 | * Include the Post-Format-specific template for the content. |
||
20 | * If you want to override this in a child theme, then include a file |
||
21 | * called content-___.php (where ___ is the Post Format name) and that will be used instead. |
||
22 | */ |
||
23 | get_template_part( 'templates/loop/content', get_post_format() ); |
||
24 | endwhile; |
||
25 | else : |
||
26 | get_template_part( 'templates/loop/content', 'none' ); |
||
27 | endif; |
||
28 | |||
29 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.