• Hi,

    I am currently using a custom theme where I have a page which displays posts from a particular category. For this page only I need to strip the images from content which is displayed but it does not seem to be working.
    I have placed the following code in my functions.php doc:

    if (is_page(305)) {
    add_filter('the_content', 'strip_images', 2);
    function strip_images($content){
       return preg_replace('/<img[^>]+./','',$content);
    }
    }

    However, this does not seem to be working. I am guessing this is because I am not actually displaying the content of page 305, but because I am querying posts from a particular category using this page. How can I strip the images out of the content I am displaying for this page only? I do, however, need to show images in the content when I am viewing the post fully using single.php.

    Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter metallikat79

    (@metallikat79)

    I managed to do it using CSS, but if anybody could share with me how to do it properly I would greatly appreciate it. Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘is_page conditional statement issue’ is closed to new replies.