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);
}
<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>
$categories = get_categories( array(
'orderby' => 'name',
'parent' => get_queried_object()->term_id,
'hide_empty' => false
) );
foreach ( $categories as $category ) : ?>
<a href="<?php echo get_category_link( $category->term_id ); ?>"><?php echo $category->name; ?></a>
<?php endforeach; ?>
//родительская
if(get_queried_object()->parent) {
echo get_cat_name(get_queried_object()->parent);
}
//текущая
echo get_queried_object()->name;
add_action( 'template_redirect', 'remove_my_action' );
function remove_my_action(){
global $post;
if(get_post_meta($post->ID, 'meta_key', true) == 'значение') {
remove_action( 'cryout_branding_hook', 'tempera_title_and_description', );
}
}
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>
<?php ob_start(); ?>
<h1><?php $queried_object = get_queried_object(); $taxonomy = $queried_object->taxonomy;$term_id = $queried_object->term_id; if( get_field('rubtitleh', $taxonomy . '_' .$term_id) ): ?>
<?php $queried_object = get_queried_object(); $taxonomy = $queried_object->taxonomy;$term_id = $queried_object->term_id; the_field('rubtitleh', $taxonomy . '_' .$term_id); ?>
<?php else : ?>
<?php single_cat_title(); ?>
<?php endif; ?></h1>
<?php $args_title = ob_get_clean();
$args['title'] = $args_title; ?>