-
AuthorPosts
-
August 1, 2018 at 5:19 pm #992487
I’m trying to hide the header “on call”. and I need help using the avia_header_class_filter. Would this be the correct filter to use? I’ve looked through some code and through the stored options int the options table for example:
post_id=5, meta_key=”header_transparency”, meta_value = “header_transparent header_hidden”
Here’s my logic:
When using my custom mobile app I am displaying some pages from the website that don’t need the header, BUT, when viewing the site regularly, with the mobile phone/desktop (ie: NOT using our mobile app) Things are as they should be. Make sense?
So I can pass a variable in the url to help achieve this and catch it in the child theme functions.phpHere is my code that is NOT working. Am I close? How can I achieve this? (I know wordpress and pass variables in urls in many projects. I just need help with the avia filter.)
URL – https://www.example.com/about-us/?show-header=no
//####### NECESSARY WORDPRESS FUNCTION TO USE A QUERY STRING VARIABLE
function add_custom_query_vars( $vars ) {
$vars[] = “show-header”;
return $vars;
}
add_filter( ‘query_vars’, ‘add_custom_query_vars’ );
$show-mobile-header = get_query_var( ‘show-header’, yes );if ($show-mobile-header == ‘no’) {
add_filter(‘avia_header_class_filter’,’avia_hide_header’, 10, 1);
}//###### Add new option for hiding header for mobile app display
function avia_hide_header($necessary) {
$necessary[‘header_transparency’] = ‘header_transparent header_hidden’;
return $necessary;
}Thanks for looking at the code and any help anyone can give.
-
This topic was modified 7 years, 6 months ago by
brayne.
August 1, 2018 at 7:47 pm #992536If anyone comes across this need. This code works.
### place in functions.php file
if (isset( $_GET[‘show_header’] )) {
$show_header = $_GET[‘show_header’];
}if ($show_header == ‘no’) {
add_filter(‘avia_header_class_filter’,’avia_hide_header’, 10, 1);
}
//###### Add new option for hiding header for mobile app display
function avia_hide_header($necessary) {
$necessary .= ‘ hide-the-header’;
return $necessary;
}place in custom CSS area or file
html.hide-the-header #header {
visibility: hidden;
height: 0px;
}August 1, 2018 at 7:53 pm #992542 -
This topic was modified 7 years, 6 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
