Completed
Push — master ( bef6ca...7e2933 )
by Fernando
03:32
created

content.php (2 issues)

Upgrade to new PHP Analysis Engine

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
	$grid_layout_enabled = ( ! is_singular() && apply_filters( 'lsx_blog_grid_layout', false ) );
17
	$image_src           = '';
18
	$image_class         = '';
19
20
	if ( true === $grid_layout_enabled ) {
21
		$thumbnail_id = get_post_thumbnail_id( get_the_ID() );
22
		$image_arr    = wp_get_attachment_image_src( $thumbnail_id, 'lsx-single-thumbnail' );
23
24
		if ( is_array( $image_arr ) ) {
25
			$image_src = $image_arr[0];
26
		}
27
28
		$image_class = 'hidden-sm hidden-md hidden-ls';
29
	}
30
?>
31
32
<article id="post-<?php the_ID(); ?>" <?php post_class( $thumb_class ); ?>>
33
	<?php lsx_entry_top(); ?>
34
35
	<?php if ( true === $grid_layout_enabled ) { ?>
36
		<div class="entry-grid-layout">
37
	<?php } ?>
38
39
	<?php if ( has_post_thumbnail() && true === $grid_layout_enabled ) { ?>
40
		<div class="entry-grid-layout-content entry-grid-layout-content-67">
41
	<?php } ?>
42
43
	<?php if ( ! has_post_thumbnail() && true === $grid_layout_enabled ) { ?>
44
		<div class="entry-grid-layout-content entry-grid-layout-content-100">
45
	<?php } ?>
46
47
	<header class="entry-header">
48 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.

Loading history...
49
			<div class="entry-image <?php echo esc_attr( $image_class ); ?>">
50
				<a class="thumbnail" href="<?php the_permalink(); ?>">
51
					 <?php lsx_thumbnail('lsx-single-thumbnail'); ?>
52
				</a>
53
			</div>
54
		<?php } ?>
55
56
		<?php 
57
			$format = get_post_format();
58
			if ( false === $format ) {
59
				$format = 'standard';
60
				$show_on_front = get_option('show_on_front','posts');
61
				if('page' == $show_on_front){
62
					$archive_link = get_permalink(get_option('page_for_posts'));
63
				}else{
64
					$archive_link = home_url();
65
				}
66
			}else{
67
				$archive_link = get_post_format_link($format);
68
			}
69
			$format = lsx_translate_format_to_fontawesome($format);
70
		?>
71
72
		<h1 class="entry-title">
73
			<?php if ( has_post_thumbnail() ) { ?>
74
				<a href="<?php echo esc_url($archive_link) ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ) ?>"></a>
75
			<?php } else { ?>
76
				<a href="<?php echo esc_url($archive_link) ?>" class="format-link fa fa-<?php echo esc_attr( $format ) ?>"></a>
77
			<?php } ?>
78
79
			<?php if ( has_post_format( array('link') ) ) { ?>
80
				<a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a>
81
			<?php } else { ?>
82
				<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
83
			<?php } ?>
84
85
			<?php if ( is_sticky() ) { ?>
86
				<span class="label label-default label-sticky"><?php esc_html_e('Featured','lsx'); ?></span>
87
			<?php } ?>
88
		</h1>
89
90
		<div class="entry-meta">
91
			<?php lsx_post_meta(); ?>
92
		</div><!-- .entry-meta -->
93
	</header><!-- .entry-header -->	
94
95
	<?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 ?>
96
		<div class="entry-summary"> 
97
			<?php the_excerpt(); ?>
98
		</div><!-- .entry-summary -->
99
	<?php elseif ( has_post_format( array('link') ) ) : ?>
100
101
	<?php elseif ( apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?>
102
		<div class="entry-content">
103
			<?php the_content(); ?>
104
		</div><!-- .entry-content -->
105
	<?php else : ?>
106
		<div class="entry-content">
107
			<?php
108
				the_content();
109
110
				wp_link_pages( array(
111
					'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
112
					'after' => '</div></div>',
113
					'link_before' => '<span>',
114
					'link_after' => '</span>'
115
				) );
116
			?>
117
		</div><!-- .entry-content -->
118
	<?php endif; ?>
119
120
	<?php if ( true === $grid_layout_enabled ) { ?>
121
		</div>
122
	<?php } ?>
123
	
124 View Code Duplication
	<?php if ( has_post_thumbnail() && true === $grid_layout_enabled ) { ?>
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.

Loading history...
125
		<div class="entry-image hidden-xs">
126
			<a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url( $image_src ); ?>);">
127
				<?php lsx_thumbnail( 'lsx-single-thumbnail' ); ?>
128
			</a>
129
		</div>
130
	<?php } ?>
131
132
	<?php if ( true === $grid_layout_enabled ) { ?>
133
		</div>
134
	<?php } ?>
135
	
136
	<div class="clearfix"></div>
137
	
138
	<?php if ( has_tag() || ( comments_open() && ! empty( get_comments_number() ) ) ) : ?>
139
		<div class="post-tags-wrapper">
140
			<?php lsx_content_post_tags(); ?>
141
			
142
			<?php if ( comments_open() && 0 != get_comments_number() ) : ?>
143
				<div class="post-comments">
144
					<a href="<?php the_permalink() ?>#comments">
145
						<?php
146
							$count = get_comments_number();
147
							printf( esc_html( _n( 'One Comment', '%1$s Comments', $count, 'lsx' ) ), esc_html( number_format_i18n( $count ) ) );
148
						?>
149
					</a>
150
				</div>
151
			<?php endif ?>
152
		</div>
153
	<?php endif ?>
154
155
	<?php lsx_entry_bottom(); ?>
156
157
	<div class="clearfix"></div>
158
159
	<?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<span class="edit-link">', '</span>' ); ?>
160
161
	<?php if ( !is_singular() && !is_single() ) { // Display full-width divider on Archives ?>
162
		<div class="lsx-breaker"></div>
163
	<?php } ?>
164
</article><!-- #post-## -->
165
166
<?php lsx_entry_after();