add perevod

This commit is contained in:
2021-12-09 00:16:01 +03:00
parent ffe37e5a27
commit 58f63ff8b6
3 changed files with 116 additions and 0 deletions

39
src/perevod.php Normal file
View File

@@ -0,0 +1,39 @@
<?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 }