Miscellany
public php v1 · immutable<?phpfunction get_category_archive_page( $post_id = 0, $cat_id = 0 ) { $post = &get_post( $post_id ); if ( !$cat_id ) { $cats = get_the_category(); $cat_id = $cats[0]->cat_ID; } foreach ( get_posts( "category=$cat_id" ) as $key => $p ) { if ( $p->ID == $post->ID ) break; } return ceil( ( $key+1 ) / get_option( 'posts_per_page' ) );}?>