AmitT /
podium
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 template for displaying all single posts. |
||
| 4 | * |
||
| 5 | * @package podium |
||
| 6 | */ |
||
| 7 | use Podium\Config\Settings as settings; |
||
| 8 | |||
| 9 | $settings = new settings(); |
||
| 10 | |||
| 11 | get_header(); |
||
| 12 | |||
| 13 | // Get primary area width |
||
| 14 | $contentWidth = $settings->getContentClass('medium-8', 'medium-12'); |
||
| 15 | ?> |
||
| 16 | <div class="grid-container"> |
||
| 17 | <div id="content" class="site-content grid-x grid-padding-x"> |
||
| 18 | <div id="primary" class="content-area small-12 <?php echo $contentWidth; ?> cell"> |
||
| 19 | <main id="main" class="site-main" role="main"> |
||
| 20 | |||
| 21 | <?php |
||
| 22 | |||
| 23 | View Code Duplication | while (have_posts()) { |
|
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | the_post(); |
||
| 26 | |||
| 27 | if (get_post_type() != 'post') { |
||
| 28 | get_template_part('template-parts/content-single', get_post_type()); |
||
| 29 | } else { |
||
| 30 | get_template_part('template-parts/content-single-post', get_post_format()); |
||
| 31 | } |
||
| 32 | |||
| 33 | the_post_navigation(); |
||
| 34 | |||
| 35 | // If comments are open or we have at least one comment, load up the comment template. |
||
| 36 | comments_template(); |
||
| 37 | |||
| 38 | } |
||
| 39 | |||
| 40 | // End of the loop. ?> |
||
| 41 | |||
| 42 | </main><!-- #main --> |
||
| 43 | </div><!-- #primary --> |
||
| 44 | <?php |
||
| 45 | |||
| 46 | if ($settings->displaySidebar()) { |
||
| 47 | |||
| 48 | get_template_part('template-parts/sidebar', 'page'); |
||
| 49 | |||
| 50 | } |
||
| 51 | |||
| 52 | ?> |
||
| 53 | </div><!-- #content --> |
||
| 54 | </div><!-- .grid-container --> |
||
| 55 | <?php get_footer(); |
||
| 56 |
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.