These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file loads the content when called. |
||
4 | * |
||
5 | * @version 1.4.8 |
||
6 | */ |
||
7 | |||
8 | $template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/" |
||
9 | |||
10 | if ( have_posts() ) : |
||
11 | |||
12 | // Load content before the loop. |
||
13 | do_action('alnp_load_before_loop'); |
||
14 | |||
15 | // Check that there are posts to load. |
||
16 | while (have_posts()) : the_post(); |
||
17 | |||
18 | $post_format = get_post_format(); // Post Format e.g. video |
||
19 | |||
20 | // Load content before the post content. |
||
21 | do_action('alnp_load_before_content'); |
||
22 | |||
23 | // Load content before the post content for a specific post format. |
||
24 | do_action('alnp_load_before_content_type_'.$post_format); |
||
25 | |||
26 | if (false === $post_format) { |
||
27 | // Include the standard content.php file. |
||
28 | get_template_part($template_location . 'content'); |
||
29 | } else { |
||
30 | // Include the post format content. |
||
31 | if (locate_template($template_location . 'format-'.$post_format.'.php') != '') { |
||
32 | get_template_part($template_location . 'format', $post_format); |
||
33 | } else { |
||
34 | // If no format-{post-format}.php file found then fallback to content-{post-format}.php |
||
35 | get_template_part($template_location . 'content', $post_format); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | // Load content after the post content for a specific post format. |
||
40 | do_action('alnp_load_after_content_type_'.$post_format); |
||
41 | |||
42 | // Load content after the post content. |
||
43 | do_action('alnp_load_after_content'); |
||
44 | |||
45 | // End the loop. |
||
46 | endwhile; |
||
47 | |||
48 | // Load content after the loop. |
||
49 | do_action('alnp_load_after_loop'); |
||
50 | |||
51 | else : |
||
52 | |||
53 | // Load content if there are no more posts. |
||
54 | do_action('alnp_no_more_posts'); |
||
55 | |||
56 | endif; // END if have_posts() |
||
0 ignored issues
–
show
|
|||
57 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.