[EventCalendar] re: Showing the event post ONLY on the day it occurs
Dave Warker
davew1 at mac.com
Tue Dec 5 18:52:39 UTC 2006
On Dec 4, 2006, at 9:35 PM
Alex Tingle <alex at firetree.net> wrote:
> That's an excellent plug-in. Less is more! May I make one
> suggestion? Increase the priority of the filter, so this gets run
> earlier than other plug-ins:
>
> add_filter('posts_where', 'wp_future_posts_plugin',1);
>
> -Alex
Alex, I tried this but the filter is still not working on my site.
Echo statements in the plug-in show it certainly appears to be
working. When I clicked the Presentations link labeled iWeb in the
right sidebar at http://acamug.org as an anonymous user I saw:
AT ENTRY TO FILTER $content is:
AND YEAR(post_date)='2007' AND MONTH(post_date)='1' AND
DAYOFMONTH(post_date)='10' AND post_name = 'iweb-demo'
AND post_date_gmt <= '2006-12-05 18:13:59' AND (post_status !=
"static")
AND post_status != "attachment"
AT EXIT FROM FILTER $content is:
AND YEAR(post_date)='2007' AND MONTH(post_date)='1' AND
DAYOFMONTH(post_date)='10' AND post_name = 'iweb-demo'
AND (post_status != "static") AND post_status != "attachment"
The post_date_gmt check is gone, however I still get a result of
"Sorry, no posts matched your criteria, please try and search again."
I even tried filtering it down to just "post_name = 'iweb-demo'" with
the same result.
Since the filter argument starts with AND I assume there is more to
the overall query, maybe I'm not filtering out something else
crucial? Should it be using another filter hook?
I guess it could even be some quirk of this site since other people
seem to have gotten it working with Wordpress 2.0. I'm new to
Wordpress filter hacking so I could be missing something obvious.
Dave
> On Mon, 4 Dec 2006 12:54:30 -0500
> Dave Warker <davew1 at mac.com> wrote:
...
>> Here is my test plug-in (between the // ----- comment lines.) The
>> original version had several options but for testing I've hard-coded
>> it to assume what I want: show future posts when they are viewed as a
>> single item. It is saved as futureposts.php, placed in the plug-ins
>> folder and activated:
>>
>> // ----- futureposts.php:
>> <?php
>>
>> function wp_future_posts_plugin($content)
>> {
>> if (is_single())
>> $content = preg_replace("/ AND post_date_gmt <= \'.+\'/", "",
>> $content);
>> return $content;
>> }
>>
>> add_filter('posts_where', 'wp_future_posts_plugin');
>>
>> ?>
>> // -----
More information about the EventCalendar
mailing list