Answer the question
In order to leave comments, you need to log in
If there are posts with this ID, then... and if not, then... WordPress, how?
Good day!
Please tell me how to make such a filter in WordPress posts:
if there are posts with such IDs, then show this ad unit, if not, then another one.
In simple words:
In some posts, the place of the adsense block is to show another ad...
Thank you very much in advance
Answer the question
In order to leave comments, you need to log in
Conditional Tags
For example, in single.php where you show ads:
<?php
$page_ids = array( 11, 34, 76, 237 ); // ID постов
if( is_single( $page_ids ) ) {
// тут показываем рекламу которая нужна на страницах этих постов
} else {
// тут показываем рекламу для всех остальных постов
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question