Wordpress - Get Post Number in a Category

Posted by Rfvgyhn on Stack Overflow See other posts from Stack Overflow or by Rfvgyhn
Published on 2010-04-07T19:29:44Z Indexed on 2010/04/07 19:33 UTC
Read the original article Hit count: 206

Filed under:
|
|
|

Is there a way for me to get a pseudo-ID of a post from the category it belongs to? Let's say I have these posts

post_id | post_title | post_cat
--------+------------+---------
0       | a post     | cat1
1       | a post1    | cat2
2       | a post2    | cat1
3       | a post3    | cat2
...
57      | a post57   | cat2

I want the posts from cat2 and the posts' ids to be relative to the category they were posted in. Something like

post_id | post_title | post_cat | cat_post_id
--------+------------+----------+--------
1       | a post1    | cat2     | 1
3       | a post3    | cat2     | 2
57      | a post57   | cat2     | 3

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about post