L
L
ligisayan2016-03-29 16:50:04
PHP
ligisayan, 2016-03-29 16:50:04

Is there a way to define the header or sidebar of a wordpress site?

Hello! There is a site on Wordpress and 2 identical widgets are used in the header and sidebar. I need to add a div block with a class to the site header, but not add it to the sidebar - if there is a way (function) to check the site header or sidebar, so that, depending on the condition, add a block or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kozlov, 2016-03-30
@ligisayan

I would create a global variable.
At the beginning of the header file, this change was assigned a value, for example, 'header', and in the sidebar - 'sidebar', respectively.
In the widget (plugin) itself, I got this variable and made a condition. 'header' this, or '
sidebar
'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question