add perevod
This commit is contained in:
39
src/perevod.php
Normal file
39
src/perevod.php
Normal 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 }
|
||||
Reference in New Issue
Block a user