just a small word why inventing is_post_type_archive($args) instead of redesigning is_home($arg) that would drasticaly simplify and unify post_type management
like
is_archive() {
//this logical tree will inspect taxonomies
//so les’t get the term_id
global $wp_query;
$term_id = $wp_query->queried_object->term_id;
} elseif is_home() {
if(is_home(‘post’)) {
//this is your home page for blog
}elseif (is_home(array(‘services’,’products’))){
//this is one of home pages for the stuff you sell..
}
}
easy isn’t it
now try to repeat that with your “new” archive api
for the 404 pages you could simply add a supplementary parameter to rewrite rule as index_rewrite_slug for custom post registration, so that would reserve the slug for extended home pages
sorry this one :
}elseif (is_home(array(‘services’,’products’))){
should be :
}elseif (is_home(array(‘service’,’product’))){
to avoid 404
easy?
sorry getting mad, i’m just a simple barman, who didn’t know php exists 2 yaers ago, now i’m creating premium plugins for my customers under thesis theme(the real framework ) and i see i will have doubled my job to get the results i had before 3.1 wp for is the guy i work with to pay my bills
sergeletko – Please be patient. The vast majority of the people who held here are unpaid volunteers. Posting over and over and getting mad doesn’t make us work faster.
just a question why changing wp_query by post type from is_home to is_archive ? especially when there’s no term set in this “archive” query ?
Because it IS an archive. What are you actually trying to do? Make an archive page for Custom Post Types?
Hi, Ipstenu , kind of you to answer .
Here’s my logic
post is a post type and the index page for post post type is_home()
now i have a product sold on a website under wp , i register it as a custom post type, i call it product instead of post , so following same trame -> index page for all products is_home() as well , but with a different post type ( is_home(‘product’) ) …
and here is wp 3.1
home is index for posts but archive is the index for products.
so next type i’m trying to get taxonomy term or asking if it is an archive i’ll have to do it like this :
if(is_archive() && !_is_post_type_archive()) or to detect post type i’ll have to do
if(is_home() || is_post_type_archive()) that’s what i call bloated code…
Both home() and archive() are idex pages but home uses post_type as criteria and archive is using taxonomy termas as criteria , that was a simple difference to understand, now it is gone with is_post_type_archive…
for me it is like making complicated instead of simplifying.
before i used different classes called to construct index pages for different post types, they were triggered by is_home() (i’m not using ancient template system but dynamic template construction )
now is is a mess , so when wp will try to use this flexible kind of templates later ( 4.0 eg ) you’ll be havig same issues…
eg i used post_thumbnails before wp 2.6
eg i’m using term_icons without a plugin now, you’ll be using them when ?