-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
front-page.phpx
48 lines (45 loc) · 1.19 KB
/
front-page.phpx
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
<?php get_header(); ?>
<!-- Content -->
<section id="contents" class="contents flex flex-col">
<?php get_template_part('part/header-image'); ?>
<div class="container">
<section class="posts">
<?php if( is_front_page() ): ?>
<?php endif; ?>
<div class="flex flex-wrap">
<?php
# list post type want to load on front page
# Get All Categories
# Get Post By Category
$categories = [
'orderby' => 'name',
'order' => 'ASC',
];
$categories = get_categories($categories);
foreach( $categories as $category ):
// Skip If Category slug uncategorized or tak berkategori
if ( in_array($category->slug, ['uncategorized', 'tak-berkategori'] ))
continue;
$args = array(
'posts_per_page' => '3',
'category__in' => [ $category->term_id ]
);
$contents = new WP_Query($args);
?>
<div class="col-2">
<?php
echo sprintf("<h1 class='title'><a style='all:unset' href='%s'>%s</a></h1>",
get_category_link($category->term_id), strtoupper($category->name));
include('post-loop.php');
?>
</div>
<?php
wp_reset_query();
endforeach; # end foreach for categories
?>
</div>
</section>
</div>
</section>
<!-- EndContent -->
<?php get_footer(); ?>