[Resolved] Mobile Menu float right open left

Home Forums Support [Resolved] Mobile Menu float right open left

Home Forums Support Mobile Menu float right open left

Viewing 8 posts - 31 through 38 (of 38 total)
  • Author
    Posts
  • #1066007
    Shirley

    I can make the filter work – thanks for your help – I think I have it from here.

    #1066014
    Leo
    Staff
    Customer Support

    No problem 🙂

    #1066342
    Shirley

    One more question please – Not sure if I can apply two filters within one function such as
    function fiveb_update_update_mobile_media_query( ) {
    if (is_front_page() || is_page( 1514 )) {
    add_filter( ‘generate_mobile_menu_media_query’, function() {
    return ‘(max-width: 1172)’;
    } );
    add_filter( ‘generate_not_mobile_menu_media_query’, function() {
    return ‘(min-width: 1173)’;
    } );
    }
    }

    #1066623
    Leo
    Staff
    Customer Support

    Don’t think that works. Just go with this:

    add_filter( 'generate_mobile_menu_media_query', function() {
        return '(max-width: 1172px)';
    } );
    add_filter( 'generate_not_mobile_menu_media_query', function() {
        return '(min-width: 1173px)';
    } );
    #1066785
    Shirley

    So modified the filter to this but still does not work. I need to filter different widths depending on page/section we are in… So far using one width but now mobile menu never appears.

    add_filter( ‘generate_mobile_menu_media_query’, function() {
    if (is_front_page() || is_page( 1514 )) {
    return ‘(max-width: 1172)’;
    } else {
    if (($post->ID == 2440) || (in_array(2440, $parents, TRUE))) {
    return ‘(max-width: 1172)’;
    } else {
    if (($post->ID == 2442) || (in_array(2442, $parents, TRUE))) {
    return ‘(max-width: 1172)’;
    } else {
    if (($post->ID == 2444) || (in_array(2444, $parents, TRUE)))
    return ‘(max-width: 1172)’;
    }
    }
    }
    } );

    add_filter( ‘generate_not_mobile_menu_media_query’, function() {
    if (is_front_page() || is_page( 1514 )) {
    return ‘(min-width: 1173)’;
    } else {
    if (($post->ID == 2440) || (in_array(2440, $parents, TRUE))) {
    return ‘(min-width: 1173)’;
    } else {
    if (($post->ID == 2442) || (in_array(2442, $parents, TRUE))) {
    return ‘(min-width: 1173)’;
    } else {
    if (($post->ID == 2444) || (in_array(2444, $parents, TRUE)))
    return ‘(min-width: 1173)’;
    }
    }
    }
    } );

    #1066789
    Leo
    Staff
    Customer Support

    Looks like the wrong syntax.

    You can either use multiple if statements or just use the elseif suggested here:
    https://www.php.net/manual/en/control-structures.elseif.php
    https://www.w3schools.com/php/php_if_else.asp

    #1066796
    Shirley

    I tried multiple if statements first and that did not work. Now I have (still not working)

    add_filter( ‘generate_mobile_menu_media_query’, function() {
    if (is_front_page() || is_page( 1514 )):
    return ‘(max-width: 1172)’;
    elseif (($post->ID == 2440) || (in_array(2440, $parents, TRUE))):
    return ‘(max-width: 1172)’;
    elseif (($post->ID == 2442) || (in_array(2442, $parents, TRUE))):
    return ‘(max-width: 1172)’;
    elseif (($post->ID == 2444) || (in_array(2444, $parents, TRUE))):
    return ‘(max-width: 1172)’;
    endif;
    } );

    add_filter( ‘generate_not_mobile_menu_media_query’, function() {
    if (is_front_page() || is_page( 1514 )):
    return ‘(min-width: 1173)’;
    elseif (($post->ID == 2440) || (in_array(2440, $parents, TRUE))):
    return ‘(min-width: 1173)’;
    elseif (($post->ID == 2442) || (in_array(2442, $parents, TRUE))):
    return ‘(min-width: 1173)’;
    elseif (($post->ID == 2444) || (in_array(2444, $parents, TRUE))):
    return ‘(min-width: 1173)’;
    endif;
    } );

    #1066930
    Tom
    Lead Developer
    Lead Developer

    At a glance, $post and $parents aren’t defined in your function. Other than that, it looks like everything should work.

Viewing 8 posts - 31 through 38 (of 38 total)
  • You must be logged in to reply to this topic.