I need to hide the branding section of my blog, but only when someone is viewing it from the iPad. I am not sure how to attack this.
EDIT: the function remove_access
currently works in my template, but I need to add the iPad function.
So would this look correct for trying to hide the area:
<?php
function remove_access() {
if(is_page(array(63, 386, 391, 405, 'forums'))) {
remove_action('thematic_header','thematic_blogtitle',3);
remove_action('thematic_header', 'thematic_blogdescription',5);
remove_action('thematic_header', 'thematic_brandingclosing',7);
remove_action('thematic_header','thematic_access',9);
remove_action('thematic_footer','thematic_siteinfoopen',20);
remove_action('thematic_footer','thematic_siteinfo',30);
}
}
if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT']) ){
add_action('template_redirect', 'remove_access');
}
EDIT-3:
the complete function
changed the condition to: if (it's an iPad AND page is blog) OR (if it's one of the pages in array), then remove items.
<?php
function remove_access() {
if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT']) && is_page('blog') || is_page(array(63, 386, 391, 405, 'forums')) ){
remove_action('thematic_header','thematic_blogtitle',3);
remove_action('thematic_header', 'thematic_blogdescription',5);
remove_action('thematic_header', 'thematic_brandingclosing',7);
remove_action('thematic_header','thematic_access',9);
remove_action('thematic_footer','thematic_siteinfoopen',20);
remove_action('thematic_footer','thematic_siteinfo',30);
}
}
add_action('template_redirect', 'remove_access');
EDIT-4:
Add a function to remove from child pages as well. I tried this, but it doesn't seem to work:
function remove_access() {
if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT']) && is_page('blog') && ($post->post_parent == 'blog') || is_page(array(63, 386, 391, 405, 'forums')) && ($post->post_parent == (63, 386, 391, 405, 'forums')) ){
remove_action('thematic_header','thematic_blogtitle',3);
remove_action('thematic_header', 'thematic_blogdescription',5);
remove_action('thematic_header', 'thematic_brandingclosing',7);
remove_action('thematic_header','thematic_access',9);
remove_action('thematic_footer','thematic_siteinfoopen',20);
remove_action('thematic_footer','thematic_siteinfo',30);
}
}
add_action('template_redirect', 'remove_access');