A
A
andrey_levushkin2020-07-29 13:54:02
WordPress
andrey_levushkin, 2020-07-29 13:54:02

How to make the script work on all pages except the main one?

There is a self-written php script in the header.php file in the theme editor. How can I make it work on ALL pages except the home page? Can some parameter be checked by a condition?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
approximate solution, 2020-07-29
@approximate_solution

https://w1c.ru/php-37.html
In the condition you check by negation if (the page is not the main one) {body}

O
Orkhan Hasanli, 2020-07-29
@azerphoenix

Can some parameter be checked by a condition?

Exactly, that's what is needed. Apply conditional logic.
if( !is_home() || !()is_front_page() )
Reading - https://codex.wordpress.org/Conditional_Tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question