add the following code inside your theme’s functions.php
↓
<?php
if (is_home() || is_front_page()){
add_filter('the_content','wpi_image_content_filter',11);
}
function wpi_image_content_filter($content){
return preg_replace("/<img[^>]+\>/i", "", $content);
}
?>
Hi
The images are still displayed.
did i miss something ?
whoops changed it too
<?php
add_filter('the_content','wpi_image_content_filter',11);
function wpi_image_content_filter($content){
if (is_home() || is_front_page()){
$content = preg_replace("/<img[^>]+\>/i", "", $content);
}
return $content;
}
?>
yes that did the trick thanks 🙂
I’ve been looking for exactly this thing and it works perfectly!! Love it!!
Only one thing…
When having it installed it does something to the rest of the function.php file. I can’t log in, comment, update the site etc. The script works brilliantly but not the rest of the site.
Any idea what the problem might be?
BTW, this is what comes up:
Cannot modify header information – headers already sent by (output started at /home/content/h/a/m/hampus/html/test/wp-content/themes/test/functions.php:15) in /home/content/h/a/m/hampus/html/test/wp-includes/classes.php on line 1586
Thanks!!
Hi everyone,
could someone please help me as I have been tearing my hair out for the last few days trying to figure this out.
What I would like to do on my website is have 3 images on the index page for each post and when clicking on the post I would like 1 to disappear.
I thought I would be able to try and integrate div classes with the code that chaoskaizer posted above but is not working at all. So really the one that would disappear would have a different div class to the other two.
Any help would be much appreciated.
i also get errors …. help me to sort out
Warning: Cannot modify header information – headers already sent by (output started at /home/careersi/public_html/wp-content/themes/tigopedia-reloaded/functions.php:25) in /home/careersi/public_html/wp-includes/pluggable.php on line 868
how to solve it ?