This is the code to add to your functions.php file:
add_filter( 'body_class', 'domain_as_body_class' ); function domain_as_body_class( $classes ) { $classes[] = sanitize_title( $_SERVER['SERVER_NAME'] ); return $classes; }
It adds the sanitized domain of your site (i.e. mydomain-com or proxydomain-com ) as the class class of the body tag of your pages, so you can configure the relative class for custom styles.
Update
For queries, you can add the function again in functions.php , for example:
function is_proxydomain() { return 'proxydomain.com' == $_SERVER['SERVER_NAME']; }
And then use it when necessary for the request:
if( is_proxydomain() ) { $args = array( // arguments for proxydomain.com ); } else { $args = array( // arguments for mydomain.com ); } $query = new WP_Query( $args );
source share