These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @package lsx |
||
4 | */ |
||
5 | ?> |
||
6 | |||
7 | <?php lsx_entry_before(); ?> |
||
8 | |||
9 | <?php |
||
10 | if ( has_post_thumbnail() ) { |
||
11 | $thumb_class = 'has-thumb'; |
||
12 | } else { |
||
13 | $thumb_class = 'no-thumb'; |
||
14 | } |
||
15 | |||
16 | if ( ! is_singular() ) { |
||
17 | $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
||
18 | } else { |
||
19 | $blog_layout = 'default'; |
||
20 | } |
||
21 | |||
22 | if ( 'list' === $blog_layout ) { |
||
23 | $image_class = 'hidden-sm hidden-md hidden-ls'; |
||
24 | } else { |
||
25 | $image_class = ''; |
||
26 | } |
||
27 | |||
28 | $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
||
29 | $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-single-thumbnail' ); |
||
30 | |||
31 | if ( is_array( $image_arr ) ) { |
||
32 | $image_src = $image_arr[0]; |
||
33 | } |
||
34 | ?> |
||
35 | |||
36 | <article id="post-<?php the_ID(); ?>" <?php post_class( $thumb_class ); ?>> |
||
37 | <?php lsx_entry_top(); ?> |
||
38 | |||
39 | <div class="entry-layout"> |
||
40 | <div class="entry-layout-content entry-layout-content-<?php echo has_post_thumbnail() ? '67' : '100'; ?>"> |
||
41 | <header class="entry-header"> |
||
42 | View Code Duplication | <?php if ( has_post_thumbnail() ) : ?> |
|
0 ignored issues
–
show
|
|||
43 | <div class="entry-image <?php echo esc_attr( $image_class ); ?>"> |
||
44 | <a class="thumbnail" href="<?php the_permalink(); ?>"> |
||
45 | <?php lsx_thumbnail( 'lsx-single-thumbnail' ); ?> |
||
46 | </a> |
||
47 | </div> |
||
48 | <?php endif; ?> |
||
49 | |||
50 | <?php |
||
51 | $format = get_post_format(); |
||
52 | |||
53 | if ( false === $format ) { |
||
54 | $format = 'standard'; |
||
55 | $show_on_front = get_option( 'show_on_front', 'posts' ); |
||
56 | |||
57 | if ( 'page' == $show_on_front ) { |
||
58 | $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
||
59 | } else { |
||
60 | $archive_link = home_url(); |
||
61 | } |
||
62 | } else { |
||
63 | $archive_link = get_post_format_link( $format ); |
||
64 | } |
||
65 | |||
66 | $format = lsx_translate_format_to_fontawesome( $format ); |
||
67 | ?> |
||
68 | |||
69 | <h1 class="entry-title"> |
||
70 | <?php if ( has_post_thumbnail() ) : ?> |
||
71 | <a href="<?php echo esc_url( $archive_link ) ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ) ?>"></a> |
||
72 | <?php else : ?> |
||
73 | <a href="<?php echo esc_url( $archive_link ) ?>" class="format-link fa fa-<?php echo esc_attr( $format ) ?>"></a> |
||
74 | <?php endif; ?> |
||
75 | |||
76 | <?php if ( has_post_format( array('link') ) ) : ?> |
||
77 | <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
||
78 | <?php else : ?> |
||
79 | <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
||
80 | <?php endif; ?> |
||
81 | |||
82 | <?php if ( is_sticky() ) : ?> |
||
83 | <span class="label label-default label-sticky"><?php esc_html_e( 'Featured', 'lsx' ); ?></span> |
||
84 | <?php endif; ?> |
||
85 | </h1> |
||
86 | |||
87 | <div class="entry-meta"> |
||
88 | <?php lsx_post_meta(); ?> |
||
89 | </div><!-- .entry-meta --> |
||
90 | </header><!-- .entry-header --> |
||
91 | |||
92 | <?php if ( ! is_singular() && ! has_post_format( array( 'video', 'audio', 'quote', 'link' ) ) && ! apply_filters( 'lsx_blog_force_content_on_list', false ) ) : // Only display Excerpts for Search and Archives ?> |
||
93 | <div class="entry-summary"> |
||
94 | <?php the_excerpt(); ?> |
||
95 | </div><!-- .entry-summary --> |
||
96 | <?php elseif ( has_post_format( array('link') ) ) : ?> |
||
97 | |||
98 | <?php elseif ( apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
||
99 | <div class="entry-content"> |
||
100 | <?php the_content(); ?> |
||
101 | </div><!-- .entry-content --> |
||
102 | <?php else : ?> |
||
103 | <div class="entry-content"> |
||
104 | <?php |
||
105 | the_content(); |
||
106 | |||
107 | wp_link_pages( array( |
||
108 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
||
109 | 'after' => '</div></div>', |
||
110 | 'link_before' => '<span>', |
||
111 | 'link_after' => '</span>' |
||
112 | ) ); |
||
113 | ?> |
||
114 | </div><!-- .entry-content --> |
||
115 | <?php endif; ?> |
||
116 | |||
117 | <div class="clearfix"></div> |
||
118 | |||
119 | <?php |
||
120 | $comments_number = get_comments_number(); |
||
121 | |||
122 | if ( has_tag() || ( comments_open() && ! empty( $comments_number ) ) ) : |
||
123 | ?> |
||
124 | |||
125 | <div class="post-tags-wrapper"> |
||
126 | <?php lsx_content_post_tags(); ?> |
||
127 | |||
128 | <?php if ( comments_open() && ! empty( $comments_number ) ) : ?> |
||
129 | <div class="post-comments"> |
||
130 | <a href="<?php the_permalink() ?>#comments"> |
||
131 | <?php |
||
132 | printf( |
||
133 | esc_html( _n( 'One Comment', '%1$s Comments', $comments_number, 'lsx' ) ), |
||
134 | esc_html( number_format_i18n( $comments_number ) ) |
||
135 | ); |
||
136 | ?> |
||
137 | </a> |
||
138 | </div> |
||
139 | <?php endif ?> |
||
140 | </div> |
||
141 | |||
142 | <?php |
||
143 | endif; |
||
144 | ?> |
||
145 | </div> |
||
146 | |||
147 | View Code Duplication | <?php if ( has_post_thumbnail() ) : ?> |
|
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. ![]() |
|||
148 | <div class="entry-image hidden hidden-xs"> |
||
149 | <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url( $image_src ); ?>);"> |
||
150 | <?php lsx_thumbnail( 'lsx-single-thumbnail' ); ?> |
||
151 | </a> |
||
152 | </div> |
||
153 | <?php endif; ?> |
||
154 | </div> |
||
155 | |||
156 | <?php lsx_entry_bottom(); ?> |
||
157 | |||
158 | <div class="clearfix"></div> |
||
159 | |||
160 | <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<span class="edit-link">', '</span>' ); ?> |
||
161 | |||
162 | <?php if ( ! is_singular() && ! is_single() ) : // Display full-width divider on Archives ?> |
||
163 | <div class="lsx-breaker"></div> |
||
164 | <?php endif; ?> |
||
165 | </article> |
||
166 | |||
167 | <?php lsx_entry_after(); |
||
168 |
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.