-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontent.php
More file actions
202 lines (163 loc) · 6.56 KB
/
content.php
File metadata and controls
202 lines (163 loc) · 6.56 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Dez
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php // Variáveis
$permalink = esc_url(get_permalink());
$link_url = get_post_meta(get_the_ID(), 'link_url', true);
?>
<?php if ( has_post_format( 'post' ) || ! has_post_format() ) : // Formato de post padrão. ?>
<header class="entry-header">
<?php
if (is_singular()) {
the_title('<h1 class="p-name">', '</h1>');
} else {
the_title('<h2 class="p-name"><a href="' . $permalink . '" rel="bookmark">', '</a></h2>');
}
?>
<div class="entry-meta">
<?php if ( ! is_page() ) { ?>
<time class="dt-published" datetime="<?php echo get_the_date( 'Y-m-d' ) . ' ' . get_the_time( 'H:m:s' ); ?>">
<?php echo get_the_date() . ', ' . get_the_time(); ?>
</time>
<?php }
// Dados de autoria
if ( in_category('patrocinios') ) {
echo '<span class="entry-spons0r">' . esc_html__('* Patrocinado', 'dez') . '</span>';
}
if ( !is_page() ) : ?>
<button class="compartilhe" aria-label="Compartilhe" onClick="compartilharPost('<?php echo esc_js(get_the_title()); ?>', '<?php echo esc_js($permalink); ?>', this);"></button>
<?php endif; ?>
<?php // Link para comentários
if ( comments_open() || get_comments_number() ) {
comments_popup_link('0', '1', '%', 'comment-link', '');
}
?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<?php if ( is_singular() && has_post_thumbnail() ) :
the_post_thumbnail(
array(1440, 960),
array('class' => 'post-thumbnail') );
endif; ?>
<div class="e-content">
<?php if ( get_the_author_meta('ID') != 1 ) { ?>
<p class="p-author"><?php pll_e('por'); ?> <?php echo esc_html(get_the_author()); ?></p>
<?php }
the_content(); ?>
</div><!-- .entry-content -->
<?php elseif ( has_post_format( 'aside' ) ) : // Formato de post aside. ?>
<header class="entry-header">
<div class="entry-meta">
<time class="dt-published" datetime="<?php echo get_the_date( 'Y-m-d' ) . ' ' . get_the_time( 'H:m:s' ); ?>">
<?php if ( !is_singular() ) :
echo '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
echo get_the_date() . ', ' . get_the_time();
echo '</a>';
else :
echo get_the_date() . ', ' . get_the_time();
endif; ?>
</time>
<button class="compartilhe" aria-label="Compartilhe" onClick="compartilharPost('<?php echo esc_js(get_the_title()); ?>', '<?php echo esc_js( esc_url(get_permalink()) ); ?>', this);"></button>
<?php // Link para comentários
if ( comments_open() || get_comments_number() ) {
comments_popup_link('0', '1', '%', 'comment-link', '');
}
?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="e-content">
<?php if ( get_the_author_meta('ID') != 1 ) { ?>
<p class="p-author">por <?php echo esc_html(get_the_author()); ?></p>
<?php }
the_content(); ?>
</div><!-- .entry-content -->
<?php elseif ( has_post_format( 'quote' ) ) : // Formato de post quote. ?>
<header class="entry-header">
<?php
if ( is_singular() ) :
the_title( '<h1 class="p-name">', '</h1>' );
else :
the_title( '<h2 class="p-name">', '</h2>' );
endif; ?>
</header><!-- .entry-header -->
<div class="e-content">
<?php if ( get_the_author_meta('ID') != 1 ) { ?>
<p class="p-author">por <?php echo esc_html(get_the_author()); ?></p>
<?php }
the_content(); ?>
</div><!-- .e-content -->
<div class="entry-meta">
<time class="dt-published" datetime="<?php echo get_the_date( 'Y-m-d' ) . ' ' . get_the_time( 'H:m:s' ); ?>">
<?php if ( !is_singular() ) :
echo '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
echo get_the_date() . ', ' . get_the_time();
echo '</a>';
else :
echo get_the_date() . ', ' . get_the_time();
endif; ?>
</time>
<button class="compartilhe" aria-label="Compartilhe" onClick="compartilharPost('<?php echo esc_js(get_the_title()); ?>', '<?php echo esc_js( esc_url(get_permalink()) ); ?>', this);"></button>
<?php // Link para comentários
if ( comments_open() || get_comments_number() ) {
comments_popup_link('0', '1', '%', 'comment-link', '');
}
?>
</div><!-- .entry-meta -->
<?php elseif ( has_post_format( 'link' ) ) : // Formato de post link. ?>
<header class="entry-header">
<?php
if (is_singular()) {
if ($link_url) {
the_title('<h1 class="p-name"><a href="' . esc_url($link_url) . '" rel="bookmark">', '</a> <span class="link-site"><img src="/wp-content/themes/dez/img/icone-link-externo.svg" width="32" height="32" alt> ' . get_post_meta(get_the_ID(), 'link_site', true) . '</span></h1>');
} else {
the_title('<h1 class="p-name">', '</h1>');
}
} else {
if ($link_url) {
the_title('<h2 class="p-name"><a href="' . esc_url($link_url) . '" rel="bookmark">', '</a> <span class="link-site"><img src="/wp-content/themes/dez/img/icone-link-externo.svg" width="32" height="32" alt> ' . get_post_meta(get_the_ID(), 'link_site', true) . '</span></h2>');
} else {
the_title('<h2 class="p-name"><a href="' . $permalink . '" rel="bookmark">', '</a></h2>');
}
}
?>
<div class="entry-meta">
<time class="dt-published" datetime="<?php echo get_the_date( 'Y-m-d' ) . ' ' . get_the_time( 'H:m:s' ); ?>">
<?php if ( !is_singular() ) :
echo '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
echo get_the_date() . ', ' . get_the_time();
echo '</a>';
else :
echo get_the_date() . ', ' . get_the_time();
endif; ?>
</time>
<button class="compartilhe" aria-label="Compartilhe" onClick="compartilharPost('<?php echo esc_js(get_the_title()); ?>', '<?php echo esc_js( esc_url(get_permalink()) ); ?>', this);"></button>
<?php // Link para comentários
if ( comments_open() || get_comments_number() ) {
comments_popup_link('0', '1', '%', 'comment-link', '');
}
?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="e-content">
<?php if ( get_the_author_meta('ID') != 1 ) { ?>
<p class="p-author">por <?php echo esc_html(get_the_author()); ?></p>
<?php }
the_content(); ?>
</div><!-- .entry-content -->
<?php endif; ?>
</article><!-- #post-<?php the_ID(); ?> -->
<?php
// Exibição do shortcode de newsletter em posts individuais
$current_lang = get_bloginfo('language');
if (is_single() && /*shortcode_exists('sc') &&*/ get_post()) {
$shortcode_name = ($current_lang == 'en-US') ? 'newsletter-post' : 'newsletter-post-en';
echo do_shortcode('[sc name="' . esc_attr($shortcode_name) . '"][/sc]');
}
?>