Last active
June 17, 2021 06:38
-
-
Save sukhikh18/fa8a090911a3eec1768ad738a6ba5325 to your computer and use it in GitHub Desktop.
Изменить блок Цитата (краткое содержание, post-excerpt) #WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom Excerpt Meta Box | |
*/ | |
define('MY_CUSTOM_POST_TYPE', 'page'); | |
add_action( 'add_meta_boxes' , 'remove_postexcerpt_box', 99 ); | |
add_action( 'add_meta_boxes', 'excerpt_box_action' ); | |
function remove_postexcerpt_box(){ | |
remove_meta_box( 'postexcerpt' , MY_CUSTOM_POST_TYPE, 'normal' ); | |
} | |
function excerpt_box_action(){ | |
$metabox_title = __( 'Custom Post Excerpt' ); | |
add_meta_box('raq_postexcerpt', $metabox_title, 'excerpt_box_custom', MY_CUSTOM_POST_TYPE, 'normal'); | |
} | |
function excerpt_box_custom(){ | |
global $post; | |
echo "<label class='screen-reader-text' for='excerpt'> {_('Excerpt')} </label> | |
<textarea rows='1' cols='40' name='excerpt' tabindex='6' id='excerpt'>{$post->post_excerpt}</textarea>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment