defined( 'ABSPATH' ) or die( 'Hey! What are you doing here? You silly human!' ); if ( ! function_exists( 'enqueue' ) ) { function enqueue() { wp_enqueue_script( 'jquery' ); wp_enqueue_style( 'swiper-slider', get_template_directory_uri() . '/assets/css/swiper.min.css', array(), null, 'all' ); wp_enqueue_script( 'swiper-slider', get_template_directory_uri() . '/assets/js/swiper.min.js', array( 'jquery' ), null, true ); wp_enqueue_style( 'style', get_template_directory_uri() . '/assets/css/style.min.css?'.time(), array(), null, 'all' ); wp_enqueue_script( 'script', get_template_directory_uri() . '/assets/js/script.min.js?'.time(), array( 'jquery' ), null, true ); } add_action( 'wp_enqueue_scripts', 'enqueue' ); } /** * Add outdatedbrowser code after body open tag */ // if( !empty( $deeplevel_core_settings[ 'outdatedbrowser' ] ) ) { // if ( ! function_exists( 'outdatedbrowser_after_body_open_tag' ) ) { // function outdatedbrowser_after_body_open_tag() // { // $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); // echo '
' , ( $lang == 'ru' ) ? 'Обновите ваш браузер для правильного отображения этого сайта.' : 'Update your browser to view this website correctly.' , '
'; // echo '' , ( $lang == 'ru' ) ? 'Обновить браузер' : 'Update browser' , ''; // echo ' и
или нет?
'save_tags' => '', // Теги, которые нужно оставить в тексте, например ''.
'more_text' => 'Читать дальше...', // Текст ссылки `Читать дальше`.
'ignore_more' => false, // нужно ли игнорировать в контенте
), $args );
$rg = apply_filters( 'kama_excerpt_args', $rg );
if( ! $rg->text )
$rg->text = $post->post_excerpt ?: $post->post_content;
$text = $rg->text;
// убираем блочные шорткоды: [foo]some data[/foo]. Учитывает markdown
$text = preg_replace( '~\[([a-z0-9_-]+)[^\]]*\](?!\().*?\[/\1\]~is', '', $text );
// убираем шоткоды: [singlepic id=3]. Учитывает markdown
$text = preg_replace( '~\[/?[^\]]*\](?!\()~', '', $text );
$text = trim( $text );
//
if( ! $rg->ignore_more && strpos( $text, '') ){
preg_match('/(.*)/s', $text, $mm );
$text = trim( $mm[1] );
$text_append = ' '. $rg->more_text .'';
}
// text, excerpt, content
else {
$text = trim( strip_tags($text, $rg->save_tags) );
// Обрезаем
if( mb_strlen($text) > $rg->maxchar ){
$text = mb_substr( $text, 0, $rg->maxchar );
$text = preg_replace( '~(.*)\s[^\s]*$~s', '\\1...', $text ); // кил последнее слово, оно 99% неполное
}
}
// сохраняем переносы строк. Упрощенный аналог wpautop()
if( $rg->autop ){
$text = preg_replace(
array("/\r/", "/\n{2,}/", "/\n/", '~
', '
', '
$text
" : $text; } function posts_shortcode_function( $attrs ) { ob_start(); $attrs = shortcode_atts( [ 'cat_id' => '', 'posts_per_page' => '5', ], $attrs ); $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = [ 'paged' => $paged, 'cat' => $attrs[ 'cat_id' ], 'post_status' => 'publish', 'posts_per_page' => $attrs[ 'posts_per_page' ], ]; $query = new WP_Query( $args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $category = get_the_category(); if( $category[0]->cat_name == 'Research' ) { ?> } else { ?>