foreach( $rand_posts as $post ) : setup_postdata($post); ?>
<?php ale_part('postpreview'); ?>
<?php endforeach; ?>
add_action( 'init', 'register_post_type_init' );
function register_post_type_init() {
$labels = array(
'name' => 'Видео',
'singular_name' => 'Видео',
'add_new' => 'Добавить видео',
'add_new_item' => 'Добавить новое видео',
'edit_item' => 'Редактировать видео',
'new_item' => 'Новое видео',
'all_items' => 'Все видео',
'view_item' => 'Просмотр видео на сайте',
'search_items' => 'Искать видео',
'not_found' => 'Видео не найдено.',
'not_found_in_trash' => 'В корзине нет видео.',
'menu_name' => 'Видеоновости'
);
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-video-alt3',
'menu_position' => 20,
'supports' => array( 'title', 'editor', 'comments', 'author', 'thumbnail'),
'taxonomies' => array( 'category' )
);
register_post_type('video', $args);
}
add_action('wpcf7_before_send_mail', 'dco_wpcf7_before_send_mail');
function dco_wpcf7_before_send_mail($contact_form) {
$submission = WPCF7_Submission::get_instance();
$data = & $submission->get_posted_data();
$subject = $data['your-subject'];
if ($subject == 'Директор') {
$mail = $contact_form->prop('mail');
$mail['recipient'] = 'director@domain.com';
$contact_form->set_properties(array('mail' => $mail));
}
if($subject == 'Менеджер') {
$mail = $contact_form->prop('mail');
$mail['recipient'] = 'manager@domain.com';
$contact_form->set_properties(array('mail' => $mail));
}
}
<div class="logo">
<?php if(!is_front_page() && !is_home()) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php endif; ?>
<?php if(get_field('logo_image', 'option')): ?>
<img src="<?php the_field('logo_image', 'option'); ?>" title="" alt="">
<?php endif; ?>
<?php if(get_field('logo_text', 'option')): ?>
<span><?php the_field('logo_text', 'option'); ?></span>
<?php endif; ?>
<?php if(!is_front_page() && !is_home()) : ?>
</a>
<?php endif; ?>
</div>
function foo_theme_customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => function() {
bloginfo( 'description' );
},
) );
}
add_action( 'customize_register', 'foo_theme_customize_register' );
add_action('customize_register', 'dco_customize_register');
function dco_customize_register($wp_customize) {
//FOOTER
$wp_customize->add_section('footer', array(
'title' => 'Подвал',
'priority' => 1,
));
//footer text
$setting_name = 'footer_text';
$wp_customize->add_setting($setting_name, array(
'default' => '',
'sanitize_callback' => 'sanitize_textarea_field',
'transport' => 'postMessage'
));
$wp_customize->add_control($setting_name, array(
'section' => 'footer',
'type' => 'textarea',
'label' => 'Текст в подвале',
));
$wp_customize->selective_refresh->add_partial($setting_name, array(
'selector' => '.footer-desc',
'render_callback' => function() use ($setting_name) {
return nl2br(get_theme_mod($setting_name));
}
));
}
<div class="footer-desc"><?php echo nl2br(get_theme_mod('footer_text')); ?></div>