These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Template part for displaying comics |
||
4 | * |
||
5 | * @package WordPress |
||
6 | * @subpackage Strip |
||
7 | */ |
||
8 | |||
9 | ?> |
||
10 | <article id="post-<?php the_ID(); ?>" <?php post_class( 'clear' ); ?>> |
||
11 | <div class="entry-wrap wrap clear"> |
||
12 | View Code Duplication | <?php if ( '' !== get_the_post_thumbnail() ) : ?> |
|
0 ignored issues
–
show
|
|||
13 | |||
14 | <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'strip' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>" class="strip-featured-thumbnail"> |
||
15 | <?php the_post_thumbnail( 'strip-featured-thumbnail' ); ?> |
||
16 | </a> |
||
17 | <?php endif; ?> |
||
18 | |||
19 | <footer class="entry-meta"> |
||
20 | <a href="<?php the_permalink(); ?>"><?php echo get_the_date(); ?></a> |
||
21 | </footer><!-- .entry-meta --> |
||
22 | |||
23 | <header class="entry-header"> |
||
24 | |||
25 | <?php // calls each series by get_the_terms, custom taxonomy "story" instead of WP native category. |
||
26 | |||
27 | $terms = get_the_terms( $post->ID, 'story' ); |
||
28 | |||
29 | foreach ( $terms as $term ) { |
||
30 | // The $term is an object, so we don't need to specify the $taxonomy. |
||
31 | $term_link = get_term_link( $term ); |
||
32 | // If there was an error, continue to the next term. |
||
33 | if ( is_wp_error( $term_link ) ) { |
||
34 | continue; |
||
35 | } |
||
36 | |||
37 | // We successfully got a link. Print it out. ?> |
||
38 | <nav class="categories-links"> |
||
39 | <?php printf( '<a href="%s" class="categories-links">%s</a>', |
||
40 | esc_url( $term_link ) , |
||
41 | esc_html( $term->name ) |
||
42 | ); |
||
43 | } ?> |
||
44 | </nav> |
||
45 | |||
46 | <?php edit_post_link( __( 'Edit Comic', 'strip' ), '<span class="edit-link">', '</span>' ); |
||
47 | |||
48 | View Code Duplication | if ( ! is_single() ) : |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
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. ![]() |
|||
49 | the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); |
||
50 | else : |
||
51 | the_title( '<h1 class="entry-title">', '</h1>' ); |
||
52 | endif; ?> |
||
53 | |||
54 | </header><!-- .entry-header --> |
||
55 | |||
56 | <?php if ( is_search() ) : // Only display Excerpts for Search — implement search for custom taxonomies. ?> |
||
57 | |||
58 | <div class="entry-summary"> |
||
59 | |||
60 | <?php the_excerpt(); ?> |
||
61 | </div><!-- .entry-summary --> |
||
62 | |||
63 | <?php else : ?> |
||
64 | |||
65 | <div class="entry-comic"> |
||
66 | <?php the_content( __( 'Continue watching <span class="meta-nav">→</span>', 'strip' ) ); ?> |
||
67 | |||
68 | <?php endif; ?> |
||
69 | </div><!-- .entry-content --> |
||
70 | </div><!-- .entry-wrap --> |
||
71 | </article> |
||
72 |
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.