add find youtube

This commit is contained in:
2022-12-09 11:45:40 +03:00
parent 41c8187b41
commit c08b539d1d
5 changed files with 39 additions and 9 deletions

View File

@@ -722,7 +722,7 @@ add_action( 'pre_get_posts', function ($query) {
}
if (is_front_page()) {
$query->set( 'posts_per_page', 25 );
$query->set( 'posts_per_page', 24 );
}
@@ -762,15 +762,40 @@ add_filter( 'the_excerpt_rss', 'add_text_to_the_feed_end' );
function add_div_youtube($content){
function add_div_youtube($str){
$content = $str;
$content = str_replace(
['<iframe', '</iframe>'],
['<div class="vijdeo"><iframe', '</iframe></div>'],
$content);
return $content;
return $content;
return find_youtube($str);
}
function find_youtube($str) {
$result = $str;
$pos1 = strpos($str, '<iframe');
$endpos = strpos($str, '</iframe>', $pos1);
$iframe_len = $endpos - $pos1;
$iframe = substr($str, $pos1, $iframe_len);
$you_find = strpos($iframe, 'src="https://www.youtube.com/');
if ($you_find) {
$result = substr( $str, 0, $pos1 -1 ).'<div class="vijdeo">'.$iframe.'</div>'.substr($str, $endpos+9);
}
return $result;
}

View File

@@ -10,7 +10,7 @@
<?if (defined('TESTMODE') and TESTMODE == 1):?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/style-test.css?ver=3">
<?else:?>
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=326">
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=328">
<?endif?>
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
<!--<link href="<?php echo get_stylesheet_directory_uri()?>/pub/fontawesome.css" rel="stylesheet">-->

View File

@@ -38,8 +38,8 @@ $nn = 0;?>
<?$nn++?>
<?if ($nn == 10):?>
<?card_post_id(23364, 'до 15 ноября 2022 года');?>
<?if ($nn == 5):?>
<?card_post_id(25830, '');?>
<?endif?>
<?if ($nn < 24):?>

View File

@@ -60,6 +60,10 @@
</div>
</div>
<div class="promo-poll">
<strong>Какие новости интересны читателям «Ветеринарии и жизни»? <a href="https://vetandlife.ru/polls/opros-kakie-novosti-interesny-chitatelyam-veterinarii-i-zhizni/">Пройти опрос</a></strong>
</div>
<div class="promo-agregators">
<p>Свежие отраслевые новости на нашем канале в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
<p>Добавьте «Ветеринарию и жизнь» в избранное в <a href="https://yandex.ru/news/?favid=254162793" target="_blank"><span class="promo_ya">Я</span><span style="font-weight: bold; color:black;">НДЕКС.НОВОСТИ</span></a></p>

View File

@@ -2340,8 +2340,9 @@ span.rub_back_title{
color: #2D9CDB;
}
.promo-poll a{
color: #2D9CDB;
}
@media screen and ( max-width: 580px ) {