Вы можете использовать это:
if ( is_page() ) {
query_posts( 'cat=3&year=2004' );
}
Вы можете использовать эти параметры для проверки страниц, на которых вы находитесь:
is_page();
// When any single Page is being displayed.
is_page(42);
// When Page 42 (ID) is being displayed.
is_page('Contact');
// When the Page with a post_title of "Contact" is being displayed.
is_page('about-me');
// When the Page with a post_name (slug) of "about-me" is being displayed.
is_page(array(42,'about-me','Contact'));
// Returns true when the Pages displayed is either post ID 42, or post_name "about-me", or post_title "Contact". Note: the array ability was added at Version 2.5.
также посмотрите на эти коды (получите сообщения от slugs):
<?php
$the_slug = 'my_slag';
$args=array(
'name' => $the_slug,
'post_type' => 'post',
'post_status' => 'publish',
'showposts' => 1,
'caller_get_posts'=> 1
);
$my_posts = get_posts($args);
if( $my_posts ) {
echo 'ID on the first post found '.$my_posts[0]->ID;
}
?>
Удачи