function lvl_home_post_slides( $atts ) {
...
$options = array(
'post_type' => $args['type'],
'posts_per_page' => $args['posts'],
'post_status' => 'publish',
'orderby' => array(
'post_date' => 'DESC',
'meta_value' => 'ASC'
),
'meta_key' => 'event_date'
);
$query = new WP_Query( $options );
...
}
function load_scripts() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_enqueue_script('jquery', '//code.jquery.com/jquery-3.4.1.min.js', array(), 'cdn', false);
add_filter('script_loader_src', 'jquery_local_fallback', 10, 2);
}
}
add_action('wp_enqueue_scripts', 'load_scripts', 100);
function jquery_local_fallback($src, $handle = null) {
static $add_jquery_fallback = false;
if ($add_jquery_fallback) {
echo '<script>window.jQuery || document.write(\'<script src="';
echo get_template_directory_uri() . '/assets/js/jquery-3.4.1.min.js';
echo '"><\/script>\')</script>' . "\n";
$add_jquery_fallback = false;
}
if ($handle === 'jquery') {
$add_jquery_fallback = true;
}
return $src;
}
add_action('wp_head', 'jquery_local_fallback');
[remotegif src=»<img src=» <img src="http://i.yapx.ru/Fn3wd.gif">» />»]
[remotegif src="http://i.yapx.ru/Fn3wd.gif"]
the_content();
echo apply_filters( 'the_content', $post_content );
echo apply_filters( 'the_content', $wp_query->post->post_content );
remove_shortcode();
remove_filter('the_content', 'wpautop');
function add_new_topic( $new_status, $old_status, $post ) {
if ( $new_status === 'publish' && $old_status !== 'publish' ) {
...
}
}
add_action( 'transition_post_status', 'add_new_topic', 10, 3 );
$fn__get_thumb_id_from_text = function( $text ){
global $post;
$meta_social_image = get_post_meta($post->ID, 'meta_social_image', true);
if ( $meta_social_image ) {
return $meta_social_image; // Всё, картинка есть, заканчиваем
}
if( preg_match( '/<img +src *= *[\'"]([^\'"]+)[\'"]/', $text, $mm ) &&
( $mm[1]{0} === '/' || strpos($mm[1], $_SERVER['HTTP_HOST']) ) ){
$name = basename( $mm[1] );
$name = preg_replace('~-[0-9]+x[0-9]+(?=\..{2,6})~', '', $name ); // удалим размер (-80x80)
$name = preg_replace('~\.[^.]+$~', '', $name ); // удалим расширение
$name = sanitize_title( sanitize_file_name( $name ) ); // приведем к стандартному виду
global $wpdb;
$thumb_id = $wpdb->get_var(
$wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = 'attachment'", $name )
);
} else {
$zm_social_image = get_theme_mod('zm_social_image');
$thumb_id = $zm_social_image;
}
return empty($thumb_id) ? 0 : $thumb_id;
};
define( 'WP_DEBUG', true );
add_shortcode( 'clinic', 'call_shortcode_clinic' );
function call_shortcode_clinic( $atts ) {
ob_start();
$atts = shortcode_atts( array( 'id' => null ), $atts );
$clinic_query = new WP_Query( array(
'post_type' => 'clinics',
'p' => intval( $atts['id'] )
));
echo '<div class="clinic">';
if ( $clinic_query->have_posts() ) :
while ( $clinic_query->have_posts() ) : $clinic_query->the_post();
get_template_part( 'template-parts/clinic', get_post_format() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
echo '</div>';
wp_reset_postdata();
return ob_get_clean();
}
add_shortcode( 'doctor', 'call_shortcode_doctor' );
function call_shortcode_doctor( $atts ) {
ob_start();
$atts = shortcode_atts( array( 'id' => null ), $atts );
$doctor_query = new WP_Query( array(
'post_type' => 'doctors',
'p' => intval( $atts['id'] )
));
echo '<div class="doctor">';
if ( $doctor_query->have_posts() ) :
while ( $doctor_query->have_posts() ) : $doctor_query->the_post();
get_template_part( 'template-parts/doctor', get_post_format() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
echo '</div>';
wp_reset_postdata();
return ob_get_clean();
}
remove_filter( 'template_redirect', 'redirect_canonical' );
function remove_redirect_guess_404_permalink( $redirect_url ) {
if ( is_404() ) { return false; }
return $redirect_url;
}
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );
<?php
/**
Plugin Name: MyAvatar Plugin
Plugin Script: my-avatar.php
Version: 1.0 (2019.09.03)
*/
add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'https://mysite.com/wp-content/uploads/2019/09/avatar-comment.png';
$avatar_defaults[$myavatar] = "#myavatar";
return $avatar_defaults;
}
, переключились в визуальный редактор и переключившись обратно в редактор кода неразрывные пробелы пропали, а вы хотели бы их оставить, то вам поможет это:function allow_nbsp_in_tinymce( $mceInit ) {
$mceInit['entities'] = 'nbsp,amp,lt,gt,mdash';
$mceInit['entity_encoding'] = 'named';
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'allow_nbsp_in_tinymce' );
function remove_nbsp( $content ){
$content = preg_replace(" ", " ", $content);
return $content;
}
add_action('content_save_pre', 'remove_nbsp');
/newsite/
отсутствует файл .htaccess
в котором должны быть правила обработки URL запросов. Самый простой способ его создать: Админ панель > Settings > Permalinks > Common Settings > выбрать Plain > нажать Save changes > и ещё раз сменить Common Settings выбрав Post name > Save changes.