L
L
Legal Adviser2020-05-10 23:49:08
css
Legal Adviser, 2020-05-10 23:49:08

Before output on different pages?

I wondered ...
WordPress has a menu that is displayed in two different places and on different pages with different css.
Wordpress has an option to add an additional class ("Css Classes (Optional)") to the menu.
For each item, I made my own extra class for the :before output and put my extras in "CSS Classes (Optional)".
But these dopas are displayed in two different places and on different pages. On that page, what is needed is displayed as it should, but on the other page, respectively, anyhow.
Question:
Is it possible to make these extras appear only on a specific page?
If possible, how?
What options can be done so as not to produce the same menu for these purposes?

5eb8724295632932534808.jpeg
5eb872e31233a717035268.jpeg
5eb872e997665863877053.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Morev, 2020-05-11
@Legal2019

Standard practice is to use body_class() and cascade style differences from the desired class. If there are not enough regular classes - on the same page there is a code example of how to add your own custom one, depending on the conditions.
If you are not satisfied with the cascade option, you can write your own Walker, where you can check and assign classes depending on your conditions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question