lightspeeddevelopment /
lsx
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Template used to display post content. |
||
| 4 | * |
||
| 5 | * @package lsx |
||
| 6 | */ |
||
| 7 | |||
| 8 | ?> |
||
| 9 | |||
| 10 | <?php lsx_entry_before(); ?> |
||
| 11 | |||
| 12 | <?php |
||
| 13 | $no_thumb_post_types = array( |
||
| 14 | 'audio' => 'audio', |
||
| 15 | 'gallery' => 'gallery', |
||
| 16 | 'image' => 'image', |
||
| 17 | 'link' => 'link', |
||
| 18 | 'quote' => 'quote', |
||
| 19 | 'video' => 'video', |
||
| 20 | ); |
||
| 21 | $no_thumb_post_formats = apply_filters( 'lsx_no_thumb_post_formats', $no_thumb_post_types ); |
||
| 22 | |||
| 23 | $has_thumb = has_post_thumbnail() && ! has_post_format( $no_thumb_post_formats ); |
||
| 24 | |||
| 25 | if ( $has_thumb ) { |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 26 | $thumb_class = 'has-thumb'; |
||
| 27 | } else { |
||
| 28 | $thumb_class = 'no-thumb'; |
||
| 29 | } |
||
| 30 | |||
| 31 | $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
||
| 32 | |||
| 33 | $image_class = ''; |
||
| 34 | |||
| 35 | $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
||
| 36 | if ( empty( $thumbnail_id ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 37 | $thumbnail_id = apply_filters( 'lsx_get_thumbnail_post_placeholder_id', $thumbnail_id, get_the_ID() ); |
||
| 38 | } |
||
|
0 ignored issues
–
show
|
|||
| 39 | $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 4 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 40 | $image_src = ''; |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 4 spaces
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 41 | |||
| 42 | if ( is_array( $image_arr ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 43 | $image_src = $image_arr[0]; |
||
| 44 | } |
||
| 45 | ?> |
||
| 46 | |||
| 47 | <article id="post-<?php the_ID(); ?>" <?php post_class( array( 'lsx-slot', $thumb_class ) ); ?>> |
||
| 48 | <?php lsx_entry_top(); ?> |
||
| 49 | |||
| 50 | <div class="entry-layout"> |
||
| 51 | <div class="entry-layout-content entry-layout-content-<?php echo has_post_thumbnail() ? '67' : '100'; ?>"> |
||
| 52 | <header class="entry-header"> |
||
| 53 | <?php if ( $has_thumb ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 54 | <div class="entry-image <?php echo esc_attr( $image_class ); ?>"> |
||
| 55 | <a class="thumbnail" href="<?php the_permalink(); ?>"> |
||
| 56 | <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
||
| 57 | </a> |
||
| 58 | </div> |
||
| 59 | <?php endif; ?> |
||
| 60 | |||
| 61 | <?php |
||
| 62 | $format = get_post_format(); |
||
| 63 | |||
| 64 | if ( false === $format ) { |
||
|
0 ignored issues
–
show
|
|||
| 65 | $format = 'standard'; |
||
| 66 | $show_on_front = get_option( 'show_on_front', 'posts' ); |
||
| 67 | |||
| 68 | if ( 'page' === $show_on_front ) { |
||
|
0 ignored issues
–
show
|
|||
| 69 | $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
||
| 70 | } else { |
||
| 71 | $archive_link = home_url(); |
||
| 72 | } |
||
| 73 | } else { |
||
| 74 | $archive_link = get_post_format_link( $format ); |
||
| 75 | } |
||
| 76 | |||
| 77 | $format = lsx_translate_format_to_fontawesome( $format ); |
||
| 78 | ?> |
||
| 79 | |||
| 80 | <h1 class="entry-title"> |
||
| 81 | <?php if ( has_post_thumbnail() ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 82 | <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ); ?>"></a> |
||
| 83 | <?php else : ?> |
||
| 84 | <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
||
| 85 | <?php endif; ?> |
||
| 86 | |||
| 87 | <?php if ( has_post_format( array( 'link' ) ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 88 | <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
||
| 89 | <?php else : ?> |
||
| 90 | <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
||
| 91 | <?php endif; ?> |
||
| 92 | |||
| 93 | <?php if ( is_sticky() ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 94 | <span class="label label-default label-sticky"><?php esc_html_e( 'Featured', 'lsx' ); ?></span> |
||
| 95 | <?php endif; ?> |
||
| 96 | </h1> |
||
| 97 | |||
| 98 | <div class="entry-meta"> |
||
| 99 | <?php lsx_post_meta_list_top(); ?> |
||
| 100 | </div><!-- .entry-meta --> |
||
| 101 | |||
| 102 | <?php lsx_post_meta_category(); ?> |
||
| 103 | |||
| 104 | </header><!-- .entry-header --> |
||
| 105 | |||
| 106 | <?php if ( has_post_format( array( 'quote' ) ) || apply_filters( 'lsx_blog_display_text_on_list', true ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 107 | |||
| 108 | <?php if ( lsx_post_format_force_content_on_list() && ! apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 109 | |||
| 110 | <div class="entry-summary"> |
||
| 111 | <?php |
||
| 112 | if ( ! has_excerpt() ) { |
||
|
0 ignored issues
–
show
|
|||
| 113 | |||
| 114 | $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
||
| 115 | $content = wp_trim_words( get_the_content(), 30 ); |
||
| 116 | $content = '<p>' . $content . '</p>' . $excerpt_more; |
||
| 117 | echo wp_kses_post( $content ); |
||
| 118 | } else { |
||
| 119 | the_excerpt(); |
||
| 120 | } |
||
| 121 | ?> |
||
| 122 | |||
| 123 | </div><!-- .entry-summary --> |
||
| 124 | |||
| 125 | <?php elseif ( has_post_format( array( 'link' ) ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 126 | |||
| 127 | <?php elseif ( apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 128 | |||
| 129 | <div class="entry-content"> |
||
| 130 | <?php the_content(); ?> |
||
| 131 | </div><!-- .entry-content --> |
||
| 132 | |||
| 133 | <?php else : ?> |
||
|
0 ignored issues
–
show
|
|||
| 134 | |||
| 135 | <div class="entry-content"> |
||
| 136 | <?php |
||
| 137 | the_content(); |
||
| 138 | |||
| 139 | wp_link_pages( array( |
||
|
0 ignored issues
–
show
|
|||
| 140 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
||
| 141 | 'after' => '</div></div>', |
||
| 142 | 'link_before' => '<span>', |
||
| 143 | 'link_after' => '</span>', |
||
| 144 | ) ); |
||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
| 145 | ?> |
||
| 146 | </div><!-- .entry-content --> |
||
| 147 | |||
| 148 | <?php endif; ?> |
||
| 149 | |||
| 150 | <?php endif; ?> |
||
| 151 | |||
| 152 | <div class="clearfix"></div> |
||
| 153 | |||
| 154 | <?php $comments_number = get_comments_number(); ?> |
||
| 155 | |||
| 156 | <?php if ( has_tag() || ! empty( $comments_number ) ) { ?> |
||
|
0 ignored issues
–
show
|
|||
| 157 | <div class="post-tags-wrapper"> |
||
| 158 | |||
| 159 | <?php lsx_content_post_tags(); ?> |
||
| 160 | |||
| 161 | <?php if ( comments_open() && ! empty( $comments_number ) ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 162 | <div class="post-comments"> |
||
| 163 | <a href="<?php the_permalink(); ?>#comments"> |
||
| 164 | <?php |
||
| 165 | if ( '1' === $comments_number ) { |
||
|
0 ignored issues
–
show
|
|||
| 166 | echo esc_html_x( 'One Comment', 'content.php', 'lsx' ); |
||
| 167 | } else { |
||
| 168 | printf( |
||
| 169 | /* Translators: %s: number of comments */ |
||
| 170 | esc_html( _nx( |
||
|
0 ignored issues
–
show
|
|||
| 171 | '%s Comment', |
||
| 172 | '%s Comments', |
||
| 173 | $comments_number, |
||
| 174 | 'content.php', |
||
| 175 | 'lsx' |
||
| 176 | ) ), |
||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
| 177 | esc_html( number_format_i18n( $comments_number ) ) |
||
| 178 | ); |
||
| 179 | } |
||
| 180 | ?> |
||
| 181 | </a> |
||
| 182 | </div> |
||
| 183 | <?php endif ?> |
||
| 184 | </div> |
||
| 185 | <?php } ?> |
||
| 186 | </div> |
||
| 187 | |||
| 188 | <?php if ( has_post_thumbnail() ) : ?> |
||
|
0 ignored issues
–
show
|
|||
| 189 | |||
| 190 | <div class="entry-image hidden-xs"> |
||
| 191 | <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url( $image_src ); ?>);"> |
||
| 192 | <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
||
| 193 | </a> |
||
| 194 | </div> |
||
| 195 | |||
| 196 | <?php endif; ?> |
||
| 197 | </div> |
||
| 198 | |||
| 199 | <?php lsx_entry_bottom(); ?> |
||
| 200 | |||
| 201 | <div class="clearfix"></div> |
||
| 202 | |||
| 203 | <div class="lsx-breaker"></div> |
||
| 204 | </article> |
||
| 205 | |||
| 206 | <?php |
||
| 207 | lsx_entry_after(); |
||
| 208 |