Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // REMOVER BASURA DEL HEAD
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'feed_links', 2);
- remove_action('wp_head', 'index_rel_link');
- remove_action('wp_head', 'wlwmanifest_link');
- remove_action('wp_head', 'feed_links_extra', 3);
- remove_action('wp_head', 'start_post_rel_link', 10, 0);
- remove_action('wp_head', 'parent_post_rel_link', 10, 0);
- remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
- // JQUERY
- if ( !is_admin() ) {
- wp_deregister_script('jquery');
- wp_register_script('jquery', ("http://code.jquery.com/jquery-1.7.1.min.js"), false);
- wp_enqueue_script('jquery');
- }
- // RECORTAR TEXTO POSTS CONTENT THE EXCERPT
- function recortar_texto($texto, $longitud = 100) {
- if((mb_strlen($texto) > $longitud)) {
- $pos_espacios = mb_strpos($texto, ' ', $longitud) - 1;
- if($pos_espacios > 0) {
- $caracteres = count_chars(mb_substr($texto, 0, ($pos_espacios + 1)), 1);
- if ($caracteres[ord('<')] > $caracteres[ord('>')]) {
- $pos_espacios = mb_strpos($texto, ">", $pos_espacios) - 1;
- }
- $texto = mb_substr($texto, 0, ($pos_espacios + 1)).'...';
- }
- if(preg_match_all("|(<([\w]+)[^>]*>)|", $texto, $buffer)) {
- if(!empty($buffer[1])) {
- preg_match_all("|</([a-zA-Z]+)>|", $texto, $buffer2);
- if(count($buffer[2]) != count($buffer2[1])) {
- $cierrotags = array_diff($buffer[2], $buffer2[1]);
- $cierrotags = array_reverse($cierrotags);
- foreach($cierrotags as $tag) {
- $texto .= '</'.$tag.'>';
- }
- }
- }
- }
- }
- return $texto;
- }
- // REGISTER SIDEBARS
- if (function_exists('register_sidebar')) {
- register_sidebar(array(
- 'name' => 'Sidebar Widgets',
- 'id' => 'sidebar-widgets',
- 'description' => 'These are widgets for the sidebar.',
- 'before_widget' => '<div id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h2>',
- 'after_title' => '</h2>'
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement