• Resolved izakicreate

    (@izakicreate)


    Hi,

    I would like to be able to hide or show elements based of if a query var is present regardless of value.

    In my particular case there is an endpoint added with add_rewrite_endpoint(). When at that endpoint, the query var is added, but it is like ?endpoint= without a value.

    Is there a way to test just for the existence of the query var?

    Thanks,
    Isaac

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter izakicreate

    (@izakicreate)

    Hi,

    I managed to resolve this another way, by adding a filter that gives the endpoint query var a value if present. Now you can check if that query var equals ‘true’ in the condition test.

    
    add_filter( 'request', 'set_my_endpoint_value' );
    function set_my_endpoint_value( $vars ) {
        if ( isset( $vars[ 'endpoint' ] ) ) {
            $vars[ 'endpoint' ] = 'true';
        }
        
        return $vars;
    }
    
    Plugin Author rtowebsites

    (@rtowebsites)

    Hello @izakicreate

    currently i think our plugin doesn′t provide it out of the box.
    But we think about to add a check for isset in future.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide/show if query var exists’ is closed to new replies.