[wp-hackers] When $posts = 1
Robert Deaton
false.hopes at gmail.com
Sun Dec 19 23:29:07 UTC 2004
try
if(count($posts) == '1')) {
instead, since you're comparing count($posts) being true rather than
being equal to 1.
On Sun, 19 Dec 2004 14:41:32 -0500, David Clark <david at davidsaccess.com> wrote:
> Hi,
>
> I can't seem to find the thread, but Michael rose the issue a while
> back in the specific case of a search that returns one, result --
> having it return are actual post rather than the results page. I want
> to generalize this to work for any listing that only has one result.
>
> I have tried the following, with no luck:
>
> function one_listing_template() {
> global $posts;
> if (1 == count($posts)) {
> load_template(get_template_directory() . '/single.php');
> exit;
> }
> }
>
> add_action('template_redirect', 'one_listing_template', 1);
>
> any ideas?
>
> dc
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>
--
--Robert Deaton
http://false-hopes.com/
A proud Linux, Firefox, and WordPress user.
Linux is not an operating system, its a way of life.
More information about the hackers
mailing list