Site logo

Archived topic

Change hook priority for different media!

5 replies · Started by johnaps on April 3, 2021

Viewing posts 1–6 of 6

Hello!

I wanted your wisdom in this, as i didnt find anything on the web.
Is it possible somwhow to change the priority of a hook from 20 to 60 for different media?
What i want is the hook to have priority 20 for (min-width: 990px) and 60 priority for (max-width: 989px)

Of course i have implemented the same behavior with 2 hooks and display:none each for the respected media but this way the page is loading 2 hooks which are basically the same, thus overloading unecessarily the page...

Do you have any ideas?

Hi Johnaps,

Adjusting the priority of hooks won't achieve display:none; effect, it's just for ordering them.

I don't quite get what you are trying to achieve here.

Let me know :)

Hi Ying!
There is a shortcode i am implementing with a hook on product pages!
Cause of my layout i need the shorcode to have 20 priority for media> 990px. (so it is on the right place for how the layout is for media>990px)
But for media<989px i need the priority to be changed to 60 so it is in the right place based on how my layout changes for this media...

(What i mentioned was, that i know that i can create 2 separate but same hooks (with the same shortcode), give them a class, and play with css to display one or the other based on media)
What my question is if there is a way to avoid the parentheses way i describe above...
Maybe with a way (php?) (that i dont yet know) that can change the priority based on viewport width...

Is that more clear maybe?
Thank you in advance!

(What i mentioned was, that i know that i can create 2 separate but same hooks (with the same shortcode), give them a class, and play with css to display one or the other based on media)

That's the way to go.

What my question is if there is a way to avoid the parentheses way i describe above…
Maybe with a way (php?) (that i dont yet know) that can change the priority based on viewport width…

No there is not :).

Ok thank you very much for your help then!
It is what it is!

No problem :)

This archived topic is closed to new replies.