-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
158 lines (122 loc) · 6.15 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
get_header(); ?>
<div class="wrap">
<?php
$show_blog_archive_title = (bool)get_theme_mod( 'sed_show_blog_archive_title' , '1' );
if( $show_blog_archive_title === true || site_editor_app_on() ) {
$hide_class = ($show_blog_archive_title === false) ? "hide" : "";
?>
<?php if (is_home() && !is_front_page()) : ?>
<header class="page-header <?php echo esc_attr( $hide_class ) ;?>">
<h1 class="page-title"><?php single_post_title(); ?></h1>
</header>
<?php else : ?>
<header class="page-header <?php echo esc_attr( $hide_class ) ;?>">
<h2 class="page-title"><?php _e('Blog', 'twentyseventeen'); ?></h2>
</header>
<?php endif; ?>
<?php
}
?>
<div id="primary" class="content-area sed-blog-content blog-content-area">
<main id="main" class="site-main" role="main">
<section class="content">
<?php $i = 0; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('row'); ?>>
<?php
ob_start();
the_excerpt();
$excerpt = ob_get_clean();
if( strlen($excerpt) > 250 ){
$excerpt = mb_substr( $excerpt , 0, 250 )."...";
}
?>
<?php if (($i % 2) == 0) { ?>
<div class="col-lg-6">
<?php if ('' !== get_the_post_thumbnail() && ! is_single()) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('home'); ?>
</a>
</div>
<?php endif; ?>
</div>
<div class="col-lg-6">
<header class="entry-header">
<div class="category">
<?php the_category(); ?>
</div>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<hr class="little-separator" />
</header>
<section class="entry-content">
<div class="excerpt" style="text-align:justify;"><?php echo $excerpt; ?></div>
<?php if ( !empty( iott_get_field('advertise_image') ) ) { ?>
<div class="sponsor">
<h6>Sponsored By:</h6>
<a href="<?php iott_the_field('advertise_link'); ?>" target="_blank"><?php the_sponsored_image( iott_get_field('advertise_image') ); ?></a>
</div>
<?php } ?>
<div class="more-info">
<a href="<?php the_permalink(); ?>" title="اطلاعات بیشتر در رابطه با <?php the_title(); ?>">اطلاعات بیشتر</a>
</div>
</section>
</div>
<?php } else { ?>
<div class="col-lg-6">
<header class="entry-header">
<div class="category">
<?php the_category(); ?>
</div>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<hr class="little-separator" />
</header>
<section class="entry-content">
<div class="excerpt" style="text-align:justify;"><?php echo $excerpt; ?></div>
<?php if ( !empty( iott_get_field('advertise_image') ) ) { ?>
<div class="sponsor">
<h6>Sponsored By:</h6>
<a href="<?php iott_the_field('advertise_link'); ?>" target="_blank"><?php the_sponsored_image( iott_get_field('advertise_image') ); ?></a>
</div>
<?php } ?>
<div class="more-info">
<a href="<?php the_permalink(); ?>" title="اطلاعات بیشتر در رابطه با <?php the_title(); ?>">اطلاعات بیشتر</a>
</div>
</section>
</div>
<div class="col-lg-6 visible-lg">
<?php if ('' !== get_the_post_thumbnail() && !is_single()) : ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('home'); ?>
</a>
</div>
<?php endif; ?>
</div>
<?php } ?>
</article>
<?php $i++; endwhile;
wp_pagenavi();
else :
endif; ?>
</section>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();