projects
/
WP-Themes
/
GovernmentEmmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d584c80
)
Function to only display posts of a certain category on the posts home page
author
Laury GvR
<laury@gaslightmedia.com>
Mon, 23 May 2016 20:23:14 +0000
(16:23 -0400)
committer
Laury GvR
<laury@gaslightmedia.com>
Mon, 23 May 2016 20:23:14 +0000
(16:23 -0400)
functions.php
patch
|
blob
|
history
diff --git
a/functions.php
b/functions.php
index
adf378a
..
c4b6b22
100644
(file)
--- a/
functions.php
+++ b/
functions.php
@@
-118,6
+118,17
@@
function glm_get_header() {
// echo '</div>';
+/**
+ * This function will ensure only the posts from a certain category will display
+ * on the blog/post home page.
+ */
+function my_home_category( $query ) {
+ if ( $query->is_home() && $query->is_main_query() ) {
+ $query->set( 'cat', '29');
+ }
+}
+add_action( 'pre_get_posts', 'my_home_category' );
+
/**
* glm_side_menu
*