Advertisement
Guest User

FUNCTIONS

a guest
Mar 7th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2. // REMOVER BASURA DEL HEAD
  3. remove_action('wp_head', 'rsd_link');
  4. remove_action('wp_head', 'wp_generator');
  5. remove_action('wp_head', 'feed_links', 2);
  6. remove_action('wp_head', 'index_rel_link');
  7. remove_action('wp_head', 'wlwmanifest_link');
  8. remove_action('wp_head', 'feed_links_extra', 3);
  9. remove_action('wp_head', 'start_post_rel_link', 10, 0);
  10. remove_action('wp_head', 'parent_post_rel_link', 10, 0);
  11. remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
  12. // JQUERY
  13. if ( !is_admin() ) {
  14. wp_deregister_script('jquery');
  15. wp_register_script('jquery', ("http://code.jquery.com/jquery-1.7.1.min.js"), false);
  16. wp_enqueue_script('jquery');
  17. }
  18. // RECORTAR TEXTO POSTS CONTENT THE EXCERPT
  19. function recortar_texto($texto, $longitud = 100) {
  20. if((mb_strlen($texto) > $longitud)) {
  21. $pos_espacios = mb_strpos($texto, ' ', $longitud) - 1;
  22. if($pos_espacios > 0) {
  23. $caracteres = count_chars(mb_substr($texto, 0, ($pos_espacios + 1)), 1);
  24. if ($caracteres[ord('<')] > $caracteres[ord('>')]) {
  25. $pos_espacios = mb_strpos($texto, ">", $pos_espacios) - 1;
  26. }
  27. $texto = mb_substr($texto, 0, ($pos_espacios + 1)).'...';
  28. }
  29. if(preg_match_all("|(<([\w]+)[^>]*>)|", $texto, $buffer)) {
  30. if(!empty($buffer[1])) {
  31. preg_match_all("|</([a-zA-Z]+)>|", $texto, $buffer2);
  32. if(count($buffer[2]) != count($buffer2[1])) {
  33. $cierrotags = array_diff($buffer[2], $buffer2[1]);
  34. $cierrotags = array_reverse($cierrotags);
  35. foreach($cierrotags as $tag) {
  36. $texto .= '</'.$tag.'>';
  37. }
  38. }
  39. }
  40. }
  41.  
  42. }
  43. return $texto;
  44. }
  45. // REGISTER SIDEBARS
  46. if (function_exists('register_sidebar')) {
  47. register_sidebar(array(
  48. 'name' => 'Sidebar Widgets',
  49. 'id' => 'sidebar-widgets',
  50. 'description' => 'These are widgets for the sidebar.',
  51. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  52. 'after_widget' => '</div>',
  53. 'before_title' => '<h2>',
  54. 'after_title' => '</h2>'
  55. ));
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement