-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews-page.php
73 lines (53 loc) · 2.21 KB
/
news-page.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
<?php
/**
* Template Name: Blog Page
* The main template file.
* @package Anton_Agency
*/
get_header('blog');
?>
<div class="container">
<div class="row">
<div class="col-md-12 mb-5">
<?php get_template_part( 'template-parts/guide-post', get_post_type() ); ?>
</div>
<?php get_sidebar();?>
<div class="col">
<?php
$cat_no_in = esc_attr(get_option('blog-source-slug'));
$post_cant = esc_attr(get_option('blog-post-cant'));
$cat_ID = esc_attr(get_option('blog-post-slug'));
$cat_ID = str_replace(' ', '', $cat_ID);
$cat_ID = explode(",", $cat_ID);
$cat_args = array(
//'order' => 'ASC',
'category',
'term_taxonomy_id' => $cat_ID,
);
$categories=get_categories($cat_args);
foreach($categories as $category)
{
echo '<div class="w-100 mb-5">';
echo '<div class="w-100 mb-3"><h3><a class="widget-title" href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name. '</a></h3></div>';
echo '<div class="row">';
$args=array(
'showposts' => $post_cant,
'category__in' => array($category->term_id),
'ignore_sticky_posts'=>1,
'category__not_in' => $cat_no_in
);
$customPost = new WP_Query($args);
if ( $customPost->have_posts() ) :
while ( $customPost->have_posts() ) : $customPost->the_post();
get_template_part( 'template-parts/post-medium' );
endwhile;
endif;
echo '</div>';
echo '</div>';
} // foreach($categories
?>
</div>
</div>
</div>
<?php
get_footer();