M
M
Mikhail Lebedev2021-11-26 00:23:54
WordPress
Mikhail Lebedev, 2021-11-26 00:23:54

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

1 answer(s)
W
WP Panda, 2021-11-26
@wppanda5

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 question

Ask a Question

731 491 924 answers to any question