-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-index.php
93 lines (62 loc) · 1.88 KB
/
template-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
<?php
/**
* Template Name: All Posts
*
* @package oko
*/
get_header();
?>
<div id='merlyn-primary'></div> <!-- allow both banner and non-banner pages to have margin top under header -->
<?php include 'page_banner.php' ?>
<main id="primary" class="site-main">
<div id='merlyn-content'>
<?php
$oko_all_query = new WP_Query( array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1) ); ?>
<?php if ( $oko_all_query->have_posts() ) : ?>
<ul>
<?php while ( $oko_all_query->have_posts() ) : $oko_all_query->the_post(); ?>
<!-- <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> -->
<?php
// the_post();
$link = get_permalink();
$cats = get_the_category();
$categories = '';
foreach( $cats as $cat ){
# code...
// echo $key . '---' . $value;
// foreach ($cat as $subcat) {
// echo $cat . ': ' . $subcat . '<br>';
// }
$categories = $categories . ' ' . $cat->name;
// echo $cat->slug;
// echo $cat->name;
// echo $cat->category;
// // echo $cat->;
// echo '<br>';
// var_dump( $cat );
}
// echo '<h1>' . get_the_category() . '</h1>';
echo '<div class="merlyn-post-wrap" data-categories="' . $categories . '">';
echo '<a href="' . $link . '">';
the_title('<h2 class="entry-title">', '</h2>');
// echo '<div class="merlyn-thumb">';
// the_post_thumbnail('large');
// echo '</div>';
echo '</a>';
echo '<div class="merlyn-content">';
the_content();
echo '</div>';
// the_excerpt('<div class="merlyn-excerpt">', '</div>');
echo '</div>';
?>
<?php endwhile; ?>
</ul>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( '' ); ?></p>
<?php endif; ?>
</div>
</main><!-- #main -->
<?php
get_sidebar();
get_footer();