stephenjames716
Member
Posted 3 years ago #
Hello,
Thanks for taking a look at my post. My site has 2 blogs on it and I am able to control what shows up on what page by doing a reset query to show a particular category. The problem that I'm having is that when clicking on the calendar in the sidebar for a particular date, it doesn't narrow down the posts particular to that day, it just shows the 10 most recent.
If I remove the reset query, the calendar function works fine.
Does anyone know if it's possible to use a calendar widget on a site with 2 blogs using a reset query in the loop?
I appreciate any suggestions.
Thanks.
Could you actually post a link to your site? I'm sure its possible but without doing a bit more research I can't tell you how.
stephenjames716
Member
Posted 3 years ago #
Sorry about that...thanks!
My Site
Could you post the code for your reset query so that I can modify it to make your site work? I think I know what the problem is
stephenjames716
Member
Posted 3 years ago #
<?php
wp_reset_query();
$per_page = get_option('posts_per_page');
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('showposts='.$per_page.'&paged='.$page.'&cat=-16');
if (have_posts()) :
while (have_posts()) : the_post();
?>
_____
our office blog is cat 16 and the main blog, which is called our "to-do" section is cat 1. So on the index.php (to-do blog) I have it set to leave out everything in cat 16.
thank you so much for your time.
Personally I would install this plugin http://wordpress.org/extend/plugins/advanced-category-excluder/
To get the calendar to work you're going to have to do:
$per_page = get_option('posts_per_page');
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$m = get_query_var('m');
$year = get_query_var('year');
$day = get_query_var('day');
query_posts('m='.$m.'year='.$year.'day='.$day.'showposts='.$per_page.'&paged='.$page.'&cat=-16');
I haven't tested that so I have no idea if it works.
stephenjames716
Member
Posted 3 years ago #
thank you, I will try this out and post the results. I appreciate your time.
stephenjames716
Member
Posted 3 years ago #
hmm, thank you for your suggestion, but it wasn't able to narrow down posts specific to a date still.
I would appreciate any other suggestions as I am not skilled in hacking code like this.
thank you.
Ok I've had a look at the code I posted and in my rush there are several errors. I have tested this on my dev site:
$per_page = get_option('posts_per_page');
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$m = get_query_var('monthnum');
$year = get_query_var('year');
$day = get_query_var('day');
$query = 'monthnum='.$m.'&year='.$year.'&day='.$day.'&showposts='.$per_page.'&paged='.$page.'&cat=-4';
query_posts($query);
stephenjames716
Member
Posted 3 years ago #
hey tomontoast,
thanks so much for your reply again. I have implemented your code on my site but for some reason it still won't narrow down the posts based on a particular day via clicking on a date in the calendar. I appreciate your time.
stephenjames716
Member
Posted 3 years ago #
would anyone else be so kind as to take a look at this for me? I have tried tomontoast's latest suggestion but it still only lists the last 10 posts rather than the posts specific to that date.
thank you.
Just a quick note you did remember to change & to & in my code? Thats a bug in this forum software.
stephenjames716
Member
Posted 3 years ago #
hello tomontoast!
thanks for your reply. I didn't know I was supposed to change that.
is this the correct code? : http://pastebin.com/m50ef4493
Thanks!
stephenjames716
Member
Posted 3 years ago #
hello tomontoast!
thank you so much for your continued time and help with this! I was not aware of the bug that changes & to &
I have implemented your code and that did the trick! Thank you!