39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
// добааить поле переводчика
|
||
|
|
/**add_action( 'init', function (){
|
||
|
|
|
||
|
|
register_post_meta( 'post', 'perevod', array(
|
||
|
|
'show_in_rest' => true,
|
||
|
|
'single' => true,
|
||
|
|
'type' => 'string'
|
||
|
|
));
|
||
|
|
|
||
|
|
|
||
|
|
});**/
|
||
|
|
|
||
|
|
|
||
|
|
add_action( 'add_meta_boxes', function (){
|
||
|
|
add_meta_box(
|
||
|
|
'subscript-post',
|
||
|
|
'Переводчик',
|
||
|
|
'perevod_post_class_meta_box',
|
||
|
|
'post',
|
||
|
|
'side',
|
||
|
|
'default'
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function perevod_post_class_meta_box( $post ) {?>
|
||
|
|
|
||
|
|
<div class="components-base-control editor-post-excerpt__textarea">
|
||
|
|
<div class="components-base-control__field">
|
||
|
|
<p>
|
||
|
|
<label class="components-base-control__label" for="perevod-name">Переводчик</label>
|
||
|
|
<input type="text" name="perevod-name" id="perevod-name" class="edit-post-post-schedule" value="<?php echo esc_attr( get_post_meta( $post->ID, 'perevod-name', true ) ); ?>">
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?php }
|