Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Last active November 23, 2017 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thierrypigot/4132226e74b411c5c1267cdf3d36592f to your computer and use it in GitHub Desktop.
Save thierrypigot/4132226e74b411c5c1267cdf3d36592f to your computer and use it in GitHub Desktop.
WordPress: Enables Editor in Media edit screen
Besoin de support WordPress ou de maintenance WordPress ?
Contactez WP Assistance : https://www.wp-assistance.fr
<?php
// Enables Editor in Media edit screen.
add_filter( 'wp_editor_settings', 'wearewp_add_editor_support_for_attachments' );
function wearewp_add_editor_support_for_attachments($settings) {
if( get_post_type() == 'attachment'){
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,ul,ol,li,code,close' );
$settings = array(
'wpautop' => true,
'textarea_name' => 'content',
'textarea_rows' => 10,
'media_buttons' => false,
'tinymce' => true,
'quicktags' => $quicktags_settings,
);
return $settings;
}
}
@thierrypigot
Copy link
Author

Display content :
<?php echo get_post_field( 'post_content', get_post_thumbnail_id() ); ?>

@thierrypigot
Copy link
Author

<?php echo nl2br( get_the_post_thumbnail_caption() ); ?>

<?php the_post_thumbnail_caption(); ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment