<?php
if ( is_page() ) {
$pageid = (int) $wp_query->post->ID;
$template = get_post_meta($pageid, '_wp_page_template', true);
echo '<p>this is the page template' . $template . '</p>';
$template = get_page_template() ;
echo '<p>this is the page template' . $template . '</p>';
}
?>
Thanks for a quick reply π
However, I realise that this doesent solve my problem entirely.
I have three domains connected to my wordpress, each serving different content and design/layout depending on which URL you visit. This works fine, until i for example visit domain1.net and want to use the wordpress search. The search result brings up pages and posts linked to the other two domains.
I took a peak at this tutorial: http://web-kreation.com/index.php/wordpress/wordpress-exclude-pages-from-search-results/ – This guy chooses which categories that are going to be included in the search.
Based on that, i guess my code would go something in the direction of this:
function mySearchPostsFilter($query) {
if (strstr($_SERVER['HTTP_HOST'], "domain1.net") ) and ($query->is_search) {
$query->set (pages with the domain1-template and category 1,2,3)
} elseif (strstr($_SERVER['HTTP_HOST'], "domain2.net") ) and ($query->is_search) {
$query->set (pages with the domain2-template and category 3,4,5)
} elseif (strstr($_SERVER['HTTP_HOST'], "domain3.net") ) and ($query->is_search) {
$query->set (pages with the domain2-template and category 4,5,6)
}
return $query;
}
add_filter('pre_get_posts','mySearchPostsFilter');
(If the domain im using the search with is this, then include this page template and these categories)
Again, thanks! π