Answer the question
In order to leave comments, you need to log in
Triggering add_filter/add_action at a certain screen size?
how to add add_filter with @media queries in functions.php
for clarity what you need:
media (max-width: 375px) {
add_filter();
add_action();
}
Answer the question
In order to leave comments, you need to log in
In js, you define the screen size, if it satisfies your conditions, then send an ajax request to the backend and execute your filters in the handler. At the same time, there is a trouble that during resizing you will most likely have to reload or those parts for which the filter is responsible
Yes, one more trouble, since js is loaded already when the page is rendered, then you will most likely have to output those parts for which the filter is responsible via ajax
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question