Архив

Архив раздела ‘PHP’
19 октября 2023 Нет комментариев

functions.php темы

if(function_exists('register_sidebar')){
	register_sidebar(array(
		'id'=>'header_contacts',
		'name'=>'HeaderContacts',
		'before_widget'=>'',
		'after_widget'=>'',
		'before_title'=>'',
		'after_title'=>'',
	));
}

в месте отображения:

<?php dynamic_sidebar( 'header_contacts' ); ?>
Categories: PHP, Web Tags:
14 октября 2023 Нет комментариев

Убрать автоматическое добавление тега br после редактирования html страницы.
Добавить в functions.php активной темы:

remove_filter('the_content','wpautop');//для контента
remove_filter('the_excerpt','wpautop');//для анонсов
remove_filter('comment_text','wpautop');//для комментарий

https://wordsmall.ru/sajtostroenie/kak-ubrat-lishnie-tegi-br-i-p-v-wordpress.html

Categories: PHP, Web Tags:
18 августа 2023 Нет комментариев
function days_to_birthdate($birthdate){
	$bd=explode('.',$birthdate);
	$bd=mktime(0,0,0,$bd[1],$bd[0],date('Y')+($bd[1].$bd[0]<=date('md')));
	return ceil(($bd-time())/86400);
}
Categories: PHP Tags:

отправить тело запроса в get запросе используя curl

$timeout=5;
$auth=array(
	'WebApiSession: '.$WebApiSession,
);
$curl=curl_init();
curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($curl,CURLOPT_TIMEOUT,$timeout);
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_HEADER,0);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_HTTPHEADER,$auth);
curl_setopt($curl,CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt($curl,CURLOPT_POSTFIELDS,$booking_data);
$result=curl_exec($curl);
Categories: PHP Tags:
26 января 2023 Нет комментариев
if(str_ireplace($array,'',$str)!=$str){
	echo 'found';
}
Categories: PHP Tags:
10 ноября 2022 Нет комментариев
$mail->SMTPOptions=array(
	'ssl'=>array(
		'verify_peer'=>false,
		'verify_peer_name'=>false,
		'allow_self_signed'=>true
	)
);
Categories: PHP Tags:
8 августа 2022 Нет комментариев
$result=array();
ob_start('ob_gzhandler');
echo json_encode($result);
Categories: PHP Tags: