-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
179 lines (150 loc) · 6.88 KB
/
test.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
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
<script>
$(document).ready(function() { // The code should be placed so it runs when the page is ready
$('ul#filter a').click(function() { // When we click on something in the filter menu
$(this).css('outline','none'); // Remove css outline
$('ul#filter .current').removeClass('current'); // Removes the current class from where it is now
$(this).parent().addClass('current'); // Adds the current class to the item we clicked on
var filterVal = $(this).text().toLowerCase().replace(' ','-'); // Get the text inside the current filter item, transform it to lowercase, replace spaces with "-" and save it to filterVal.
if(filterVal == 'all') { // If we clicked on "ALL"
$('ul#post-container li.hidden').fadeIn('slow').removeClass('hidden'); // Removes all the hidden classes and show all posts
} else {
$('ul#post-container li').each(function() { // Loop through all post items
if(!$(this).hasClass(filterVal)) { // If the post item does NOT have the class we clicked on (the category)
$(this).fadeOut('normal').addClass('hidden'); // hide it
} else { // If the post item have the class with the category name we clicked on...
$(this).fadeIn('slow').removeClass('hidden'); // ...fade it slowly in
}
});
}
return false;
});
}); // end document ready
</script>
<!-- Post Body Loop-->
<ul id="post-container">
<!-- beginning of the loop -->
<?php
// The Query
$the_query = new WP_Query();
// The Loop
while ( $the_query -> have_posts() ) : $the_query -> the_post();?>
<!-- every post within list-items <li> with category-slug as classes -->
<li class="<?php foreach((get_the_category()) as $category) {
echo get_cat_slug($category->cat_ID) . ' ';} ?> post-excerpt sixteencol">
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
<div class="post-body">
<aside class="fourcol">
<ol>
<li><?php the_time('F jS, Y'); ?> <span class="icon">P</span></li>
<li>Comments <span class="icon">:</span></li>
<ul class="tags">
<?php the_category(', ') ?>
</ul>
</ol>
</aside>
<div class="content twelvecol last">
<span class="author">By <?php the_author_posts_link() ?></span>
<?php the_excerpt(); ?>
<a href="#" class="read-more">(...read more)</a>
</div>
</div>
<li>
<?php endwhile;
if(function_exists('wp_paginate')) {
wp_paginate();
}
// Reset Post Data
wp_reset_postdata();
?>
<!-- edit -->
</ul>
<!-- Post Body Loop-->
<ul id="post-container">
<!-- beginning of the loop -->
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li class="post-excerpt sixteencol">
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
<div class="post-body">
<aside class="fourcol">
<ol>
<li><?php the_time('F jS, Y'); ?> <span class="icon">P</span></li>
<li>Comments <span class="icon">:</span></li>
<ul class="tags">
<?php the_category(', ') ?>
</ul>
</ol>
</aside>
<div class="content twelvecol last">
<span class="author">By <?php the_author_posts_link() ?></span>
<?php the_excerpt(); ?>
<a href="#" class="read-more">(...read more)</a>
</div>
</div>
</li>
<?php endwhile; else : endif; ?>
</ul>
<!-- Post Body Loop-->
<!-- beginning of the loop -->
<ul id="post-container">
<?php
// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();?>
<li>
<?php the_title(); ?>
</li>
<?php endwhile;
// Reset Post Data
wp_reset_postdata();
?>
</ul>
<li class="<?php foreach((get_the_category()) as $category) {
echo get_cat_slug($category->cat_ID) . ' ';} ?> post-excerpt sixteencol">
<?php
$category = get_the_category();
$cat_=name = $category[0]->cat_name;
?>
<li class="<?php echo ">
<li class="<?php foreach(get_the_category() as $category) {
echo $category->slug . ' ';} ?>">
<!-- if else thumbnails test -->
<!-- If Post-Thumbnail Exists -->
<?php if( has_post_thumbnail()) {
echo
'<div class="post-body">
<aside class="fourcol">
<div class="excerpt-image row">
<?php
if ( has_post_thumbnail() ) {the_post_thumbnail();}
?></div>
<ol class="row">
<li><?php the_time("M. j, Y"); ?> <span class="icon">P</span></li>
</ol>
</aside>
<div class="content twelvecol last">
<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
<span class="author row">By <?php the_author_posts_link() ?>
</span>
<?php echo get_post_meta($post->ID, "description", true); ?>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="read-more">(...read more)</a>
</div>
</div>';
} else {
echo
'<div class="post-body">
<div class="content sixteencol last">
<ol class="row">
<li><?php the_time("M. j, Y"); ?> <span class="icon">P</span></li>
</ol>
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
<span class="author row">By <?php the_author_posts_link() ?>
</span>
<?php echo get_post_meta($post->ID, "description", true); ?>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="read-more">(...read more)</a>
</div>
</div>';
}?>