Hoy en AyudaWordPress.com | ![]() |
Cerrar automáticamente tags HTML que dejaste abiertas Posted: 16 Oct 2013 02:31 AM PDT Tanto si usas habitualmente el editor de Texto (HTML) como si tienes la fea costumbre de copiar y pegar desde procesadores de texto como Word, más de una vez te habrás olvidado cerrar tags HTML que, si nada lo remedia, destrozarán el diseño de tu web.
Así que si tienes tendencia a cometer este tipo de errores, o tienes colaboradores que no tienen el suficiente cuidado, puedes añadir una función a tu plugin personalizado para que cierre automáticamente toda tag HTML que se haya que dado abierta por error. // CERRAR TAGS HTML QUE HAN QUEDADO ABIERTAS POR ERROR function clean_bad_content($bPrint = false) { global $post; $szPostContent = $post->post_content; $szRemoveFilter = array("~<p[^>]*>\s?</p>~", "~<a[^>]*>\s?</a>~", "~<font[^>]*>~", "~<\/font>~", "~style\=\"[^\"]*\"~", "~<span[^>]*>\s?</span>~"); $szPostContent = preg_replace($szRemoveFilter, '', $szPostContent); $szPostContent = apply_filters('the_content', $szPostContent); if ($bPrint == false) return $szPostContent; else echo $szPostContent; } Guardas los cambios y ya está. En la línea 5 ( |
You are subscribed to email updates from Ayuda WordPress To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No hay comentarios:
Publicar un comentario