Ephemera Widget: Quotes without blog posts
-
Hi there,
This is a twentyfourteen theme problem.
I’m trying to get the ephemera Widget to display cute quotes (from posts) *without* those “Quotes posts” also showing up on the static blog page where other, regular “bloggy” posts appear.
My current solution/idea has been to:
1) Create a “Quotes” Category
2) Place the quotes posts into that category only
3) With child-domain custom function.php, exclude that category from appearing on the blog page.I have followed the instructions from here:
https://www.locoed.com/web-design/how-to-exclude-category-posts-wordpress-tutorial-code/
…and it actually works very well. Except that it works *too* well: it excludes that category from showing up within the Ephemera Widget as well! ??
Please consider the PHP code below (yes, the xx is replaced for the category code):
function exclude_category($query) { if ( $query->is_home() || ($query->is_archive() && !$query->is_category())) { $query->set('cat', '-xx'); } return $query; } add_filter('pre_get_posts', 'exclude_category');
…and kindly tell me how I could create an exception that would allow for the Ephemera Widget *not* to block that category.
Thanks!
- The topic ‘Ephemera Widget: Quotes without blog posts’ is closed to new replies.