How to set default metaboxes on user creation?

Based on this Answer by t31os. Here, all meta boxes are being set to invisible, so simply remove from the array the ones that are meant to be visible. add_action(‘user_register’, ‘wpse_58645_set_user_metaboxes’); function wpse_58645_set_user_metaboxes( $user_id ) { update_user_meta( $user_id, ‘metaboxhidden_post’, array( ‘authordiv’, ‘categorydiv’, ‘commentstatusdiv’, ‘formatdiv’, ‘postcustom’, ‘postexcerpt’, ‘postimagediv’, ‘slugdiv’, ‘tagsdiv-post_tag’, ‘trackbacksdiv’, ) ); } For registered … Read more

Disable WYSIWYG rich text editor only on post excerpt

Excerpts can be automatically generated in which case you have some control over them or manually generated in which case there is very little control available, and the wordpress way is that they may have any type of content. if you need something more restrictive you will need to create your own “meta box” for … Read more

End excerpt at the end of the sentence

Use this function instead. Then put the_excerpt(); in your template. /** * Find the last period in the excerpt and remove everything after it. * If no period is found, just return the entire excerpt. * * @param string $excerpt The post excerpt. */ function end_with_sentence( $excerpt ) { if ( ( $pos = mb_strrpos( … Read more

Limit the Excerpt field in WP-Admin in words

You can use something like jQuery Simply Countable plugin and attach it to excerpt input. Limit_Excerpt_Words::on_load(); class Limit_Excerpt_Words { static function on_load() { add_action( ‘admin_enqueue_scripts’, array( __CLASS__, ‘admin_enqueue_scripts’ ) ); } static function admin_enqueue_scripts() { global $hook_suffix; if ( ‘post.php’ == $hook_suffix || ‘post-new.php’ == $hook_suffix ) { wp_enqueue_script( ‘jquery-simply-countable’, plugins_url( ‘/jquery.simplyCountable.js’, __FILE__ ), array( … Read more

Custom Excerpt is returning 52 characters and not 52 words

The function you want is wp_trim_words(), example: function themeTemplate_trim_excerpt( $content ) { $more=”…”; //where $more is optional return wp_trim_words($content, 52, $more); } remove_filter(‘get_the_excerpt’, ‘wp_trim_excerpt’); add_filter(‘get_the_excerpt’, ‘template_trim_excerpt’);

Modify Twenty Fourteen Home Page Content Limit & Add Read More Link

The twentyfourteen index page calls get_template_part( ‘content’, get_post_format() ); inside the loop. So the content of the loop resides in template files with the name content-{$post_format}.php. All posts that does not have a post format uses content.php to display the post data If you look at content.php, these lines are where the content is retrieved … Read more