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>
add_filter( 'display_post_states', 'custom_post_state' );
function custom_post_state( $states ) {
global $post;
$show_custom_state = null !== get_post_meta( $post->ID, '_some_costom_field' );
if ( $show_custom_state ) {
$states[] = __( 'Custom State' );
}
return $states;
}
function my_shortcode_function() {
ob_start();
$parametri = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts' => 1
);
$moi_zapros = null;
$moi_zapros = new WP_Query($parametri);
if ($moi_zapros->have_posts()):
print '<ol>';
while ($moi_zapros->have_posts()) : $moi_zapros->the_post();
$idt=get_the_ID();
$trip=get_post_meta($idt,"trip", true);?>
<li class="map"><a href="<?php the_permalink() ?>" title="Постоянный линк для:<?php the_title_attribute(); ?>" target="_blank"><?php the_title(); if ($trip) {echo " ", $trip, ". День ",get_post_meta($idt,"day", true), ". ";}?> (<?php print get_comments_number();?>)</a></li>
<?php
endwhile;
print '</ol>';
endif;
wp_reset_query();
return ob_get_clean();
}
<?php
/*
Template Name: Full-width layout
Template Post Type: post, page, event
*/
// Page code here...
category-{slug}.php
category-{ID}.php
Почему в Wordpress нет функционала
<?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; ?>
Эти страницы не входят в состав категорий, т.к. у них кастомный шаблон