Posted By

distribuida on 09/06/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kurt


wordpress: funciones útiles para functions.php


 / Published in: PHP
 

  1. /*------------- WIDGETS --------------*/
  2. if (function_exists('register_sidebar')) {
  3. register_sidebar(array(
  4. 'name' => 'Sidebar Widgets',
  5. 'id' => 'sidebar-widgets',
  6. 'description' => 'These are widgets for the sidebar.',
  7. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  8. 'after_widget' => '</div>',
  9. 'before_title' => '<h2>',
  10. 'after_title' => '</h2>'
  11. ));
  12. }
  13.  
  14.  
  15. /*------------- IMAGES --------------*/
  16. //Prevent post images from being displayed on homepage
  17. add_filter('the_content','wpi_image_content_filter',11);
  18. function wpi_image_content_filter($content){
  19. if (is_home() || is_front_page()){
  20. $content = preg_replace("/<img[^>]+\>/i", "", $content);
  21. }
  22. return $content;
  23. }

Report this snippet  

You need to login to post a comment.