I
I
Ivan2018-08-13 03:23:57
css
Ivan, 2018-08-13 03:23:57

How to set classes in WP widget code so that styles can be edited?

I am creating an ad block widget in the blog sidebar, what classes should I write in the widget code so that each WP user can customize the ad block to his style, to his site design?
In the widget itself, I added a field so that I could enter my styles, but how do I call them in the code of my widget so that there are no conflicts with the main styles of the site?
Do I need to classify everything in the block at all, or is it enough to mark it in a div and give a class to it?
Help me please.
Here is an example of my code:

<h2 class="widget-title">Рекламный блок</h2>

<style>место для стилей</style>

<p>
<a href="...">
    <img src="картинка" alt="alt">
</a>

<a href="...">Заголовок</a>
<p>Подпись</p>
<p class="section__list"></p>
</p>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2018-08-13
@sergey_st

You can add a prefix with the plugin/widget name to all classes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question