add_filter( 'post_gallery', 'my_gallery_shortcode', 10, 3 );
function my_gallery_shortcode( $output = '', $atts = null, $instance = null ) {
$return = $output; // fallback
// retrieve content of your own gallery function
$my_result = get_my_gallery_content( $atts );
// boolean false = empty, see http://php.net/empty
if( !empty( $my_result ) ) {
$return = $my_result;
}
return $return;
} add_action( 'wp_enqueue_scripts', 'theme_scripts' );
function theme_scripts() {
wp_enqueue_style( 'theme-style', get_stylesheet_uri(), array(), filemtime( get_theme_file_path( '/style.css' ) ) );
}get_stylesheet_uri() получит ссылку на стили дочерней темы, а не родительскойwp_enqueue_style() и wp_enqueue_script() будете передавать их версию. Тогда браузер сам скачает новую версию файла, если она измениласьif ( $query->have_posts() ) {
$i = 1;
while ( $query->have_posts() ) {
$query->the_post();
if ( $i == 1 ) {
get_template_part( 'templates/template-one' ); // первый
} elseif( $i == 2 ) {
get_template_part( 'templates/template-two' ); // второй
} else {
get_template_part( 'templates/template-common' ); // остальные
}
$i++;
}
} else {
// Постов не найдено
} register_post_type() и register_taxonomy() соответственно. Эта регистрация может осуществляться в теме или в плагинахif ( get_post_type() === 'service' ) { ... } в любом месте проекта (где определены глобальные переменные)/*
Template Name: Мой шаблон страницы
Template Post Type: post, page, service
*/ __(), _e(), esc_html__(), esc_html_e() и подобные<?php echo esc_html__( 'Any text with HTML', 'domain' );