Repository navigation
Expand file tree
/
Copy pathcontent-whitepaper.php
More file actions
176 lines (147 loc) · 4.49 KB
/
Copy pathcontent-whitepaper.php
File metadata and controls
176 lines (147 loc) · 4.49 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
<div class="wrapper">
<?php
wp_enqueue_script('custom-nf-code');
$ids = [];
if (have_posts()) :
while (have_posts()) : the_post();
$date = (string)get_the_date('F d, Y');
$cat = get_the_category();
$author_id = (int)get_the_author_meta('ID');
$id = get_the_ID();
if ($id !== false) {
$ids[] = $id;
}
?>
<section class="single-hero-section" style="">
<div class="container">
<div class="row">
<div class="col-12">
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="section-title">
<span class="whitepaper-label">
<?php
if (get_post_type() == 'whitepapers') {
echo __('Whitepaper', 'nextcloud');
} elseif (get_post_type() == 'case_studies') {
echo __('Case study', 'nextcloud');
} elseif (get_post_type() == 'data_sheets') {
echo __('Data sheet', 'nextcloud');
}
?>
</span>
<?php
echo '<h1>' . get_the_title() . '</h1>';
?>
</div>
</div>
<div class="col-4">
</div>
</div>
</div>
</section>
<section class="post-single-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 col-md-12 whitepaper_desc_col">
<div class="text-block">
<?php
if (get_the_excerpt() && !get_the_content()) {
echo get_the_excerpt();
} else {
//echo get_the_content();
echo apply_filters('the_content', get_the_content());
}
?>
</div>
</div>
<div class="col-lg-4 col-md-12 download_whitepaper_col">
<div class="download_whitepaper_content">
<h3>
<?php
if (get_post_type() == 'whitepapers') {
echo __('Download whitepaper', 'nextcloud');
} elseif (get_post_type() == 'case_studies') {
echo __('Download case study', 'nextcloud');
} elseif (get_post_type() == 'data_sheets') {
echo __('Download data sheet', 'nextcloud');
}
?>
</h3>
<?php
echo '<div class="form-body download_whitepaper_form">';
if (get_post_meta(get_the_ID(), 'custom_ninja_form', true)) {
//if custom shortcode is in the custom field
echo do_shortcode(get_post_meta(get_the_ID(), 'custom_ninja_form', true));
} else {
echo do_shortcode("[ninja_form id='4']");
}
echo '</div>';
?>
</div>
</div>
</div>
</div>
</section>
<section class="related-posts-section">
<div class="container">
<div class="row">
<div class="col-12">
<div class="section-title">
<h3>
<?php
if (get_post_type() == 'whitepapers') {
echo __('Other whitepapers', 'nextcloud');
} elseif (get_post_type() == 'case_studies') {
echo __('Other case studies', 'nextcloud');
} elseif (get_post_type() == 'data_sheets') {
echo __('Other data sheets', 'nextcloud');
}
?>
</h3>
</div>
<div class="row related-slider-old">
<?php
$my_wp_query = new WP_Query();
/** @var WP_Post[] $onepost */
$onepost = $my_wp_query->query([
'post_type' => get_post_type(),
'post__not_in' => $ids,
'posts_per_page' => 3,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
//'category__not_in'=> array(225, 226) //exclude Private category
]);
foreach ($onepost as $onepostsingle) {
$post_id = $onepostsingle->ID;
//$img = wp_get_attachment_url(get_post_thumbnail_id($post_id) ?: 0) ?: '';
$title = $onepostsingle->post_title;
$ex = $onepostsingle->post_excerpt;
$link = (string)get_permalink($post_id);
$featured_image = get_the_post_thumbnail($post_id, 'large', [ 'class' => 'feat_img' ]);
echo '<div class="col-lg-4">';
echo '<div class="post-box">';
echo '<div class="post-img" style=""><a href="' . $link . '" title="' . $title . '">' . $featured_image . '</a></div>';
echo '<div class="post-body">';
echo '<h4><a href="' . $link . '" title="' . $title . '">' . $title . '</a></h4>';
echo '<p>' . $ex . '</p>';
echo '<a class="c-btn" href="' . $link . '">' . __('Download', 'nextcloud') . '</a>';
echo '</div>';
echo '</div>';
echo '</div>';
}
wp_reset_query();
?>
</div>
</div>
</div>
</div>
</section>
<?php
endwhile; // End of the loop.
endif;
?>
</div>