Looks handy. Thanks!
But what i’m trying to archieve is a url rewrite. Not a redirect.
Basicly all http://www.domain.com/products/product has to rewrite to a ‘fake’ subdomain http://www.product.domain.com
What the code snippet does is check if the current page has a parent page and returns the value. You could do a check then with a simple if statement like:
if(is_subpage()){
do something
}
else { do other things }
Hope this helps. 🙂
Nope this should work in any php file.
Here’s another little snippet i use alot on my pages.
<?php
$pages = get_pages('child_of='.$post->ID.'');
foreach ($pages as $page) {
$item = '<li><a href="'.get_permalink($page->ID).'" title="Click here to go to the product details">Show details</a></li>';
echo $item;
}
?>