render shortcode and include image in help metabox

This commit is contained in:
jorge 2022-07-23 16:29:03 +02:00
parent 6adc0b13fb
commit a91c74f025
3 changed files with 9 additions and 6 deletions

BIN
assets/img/PFC-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -44,7 +44,9 @@ define( 'HANGAR_WPPLUGIN_VERSION', '1.0.0' );
* define Plugin path * define Plugin path
* https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-1113 * https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-1113
* * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * */
define( 'HANGAR_WPPLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'HANGAR_WPPLUGIN_PATH', plugin_dir_path( __FILE__ ) ); //in server
define( 'HANGAR_WPPLUGIN_URL', plugin_dir_url( __FILE__ ) ); //public
include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-init-textdomain.php'); include( HANGAR_WPPLUGIN_PATH . 'includes/hangar-init-textdomain.php');

View File

@ -64,8 +64,8 @@ if ( ! function_exists( 'hangar_extra_content_callback' ) ) :
$hangar_extra_content_stored_meta = get_post_meta( $post->ID ); $hangar_extra_content_stored_meta = get_post_meta( $post->ID );
?> ?>
<p> <p>
<span class="row hangar-title"><?php _e( 'Estas son las opciones de cada entrada o página de la web.', 'hangar-wpplugin-textdomain' )?></span> <span class="row hangar-title"><?php _e( 'Estas son las opciones de cada <em>entrada</em> o <em>página</em> de la web.', 'hangar-wpplugin-textdomain' )?></span>
<span class="row hangar-title"><?php _e( 'Para mostrar las entradas o páginas debes poner el <pre>[shortcode]</pre> que genera el icono <em>PFC</em> que ves en la barra de edición de texto.', 'hangar-wpplugin-textdomain' )?></span> <span class="row hangar-title"><?php _e( 'Para mostrar las entradas o páginas debes poner el <code>[shortcode]</code> que genera el icono <img src="' . HANGAR_WPPLUGIN_URL . 'assets/img/PFC-icon.png" alt="PFC icon" style="margin-bottom:-8px;"/> que ves en la barra de edición de texto.', 'hangar-wpplugin-textdomain' )?></span>
<div class="row hangar-content"> <div class="row hangar-content">
</div> </div>
</p> </p>
@ -79,7 +79,7 @@ if ( ! function_exists( 'hangar_extra_content_callback' ) ) :
$settings = array( $settings = array(
'textarea_name' => 'hangar_extra_content_wysiwyg_summary', 'textarea_name' => 'hangar_extra_content_wysiwyg_summary',
'media_buttons' => true, 'media_buttons' => true,
'textarea_rows' => 3, 'textarea_rows' => 10,
// https://www.kevinleary.net/customizing-tinymce-wysiwyg-editor-wordpress/ // https://www.kevinleary.net/customizing-tinymce-wysiwyg-editor-wordpress/
// 'tinymce' => array( // 'tinymce' => array(
// 'toolbar1' => 'formatselect,bold,italic,link,unlink,charmap,removeformat,wp_more', // 'toolbar1' => 'formatselect,bold,italic,link,unlink,charmap,removeformat,wp_more',
@ -133,8 +133,9 @@ if ( ! function_exists( 'hangar_show_extra_content' ) ) :
$meta_value = get_post_meta( get_the_ID(), 'hangar_extra_content_wysiwyg_summary', true ); $meta_value = get_post_meta( get_the_ID(), 'hangar_extra_content_wysiwyg_summary', true );
// Checks and displays the retrieved value // Checks and displays the retrieved value
if( !empty( $meta_value ) ) { if( !empty( $meta_value ) ) {
echo '<div class="hangar-">'; echo '<div class="hangar-extra-content">';
echo $meta_value; // to do shortcodes: https://developer.wordpress.org/reference/functions/apply_filters/
echo apply_filters( 'the_content', $meta_value);
echo '</div>'; echo '</div>';
} }
} }