[wp-hackers] Post in appropriate category view.

Dave Mee davemee at gmail.com
Thu Aug 20 14:31:16 UTC 2009


Hi Diaan,

I have a very rudimentary plugin designed to provide 'page X of Y' feedback
features to wordpress - however, when I wrote it I was new to writing WP
plugins, so it's a template tag you'll need to insert manually into your
theme.

/**
 * Identify which page a post is on, based on the number of posts per page
option
 *
 * @param string $postid Required. The ID of the current post
 * @param string $category Category list, either a single ID or multiple,
separated by commas
 * @return int The page the post occurs on.
 *
 */
function get_current_page($postid=0, $category = '')

If you're interested in giving it a whirl (and helping me be sure it works
for other people before releasing it) drop me a line and I'll send it over
to you.

It is a computationally heavy calculation, but this plugin implements
cacheing which should ease the burden.

While I'm here - does anyone have any good advice on how to implement
query-parameter style parsing for functions? Is this still the official way
to implement them, rather than multiple parameters?

Best

Dave

> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
> bounces at lists.automattic.com] On Behalf Of Diaan Mynhardt
> Sent: 20 August 2009 14:33
> To: wp-hackers at lists.automattic.com
> Subject: [wp-hackers] Post in appropriate category view.
> 
> Hello all
> 
> I have a problem that I am unable to solve. I can best describe it with
> a simple scenario.
> 
> Lets say I have 30 posts in a category and I am displaying that
> category
> as 3 pages of 10 posts each. Post 1-10 on page one, 11-20 on page two,
> and so on.
> 
> When viewing, say, post 15 on it's own I would like to be have a link
> that takes me directly to page two of the category view where post 15
> is
> listed.
> 
> I can think of various computationally intense methods of doing this,
> but I'm hoping that there is some simpler method.
> 
> (Also, I hope the solution hasn't been staring me in the face.)
> 
> --
> Diaan Mynhardt
> http://dreamfoundry.co.za
> +27 84 580 6018
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list