Archive for 八月, 2013

To remove all the widgets from the dashboard screen, use: function remove_dashboard_widgets(){ remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // Right Now remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Recent Comments remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Press remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress blog remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Ot ...

mb_strimwidth() 这个函数是用来截取置顶长度的字符的。使用方法: string mb_strimwidth ( string $str , int $start , int $width [, string $trimmarker [, string $encoding ]] ) 参数说明: $str //要截短的字符串 $start //开始位置的偏移。从这些字符数开始的截取字符串。(默认是 0 个字符) $width //截取文字的宽度 $trimmarker //当字符串被截短的时候,将此字符串添加到截短后的末尾。 $encoding //参数为字符编码。如果省略,则使用内部字符编码。 <?php echo mb_strimwidth("Hello World", 0, 10, "..."); // 输出 Hello W... ?> wordpress 截取文章长度 <?php echo mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,230," ...",'utf-8'); ?>