• Resolved YoChen

    (@piedro)


    Hello!

    I like to show “the_content” on archive pages without images and without the shortcode brackets for galleries. I can hide the images by adding a CSS class with and set “display: none;” for img tags.

    But I can’t get rid of the shortcodes still showing as link in brackets within the teaser displayed by “the_content”.

    I found this function:

    function remove_shortcode_from_index($content) {
      if ( is_home() ) {
        $content = strip_shortcodes( $content );
      }
      return $content;
    }
    add_filter('the_content', 'remove_shortcode_from_index');

    How do I have to change it to remove shortcodes from all expressions of “the_content” showing (not only on the homepage!)

    thx,
    piedro

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter YoChen

    (@piedro)

    P.S.: I also tried:

    add_filter('the_content', 'remove_shortcode');

    but this gives me just completey empty entries

    plz help, piedro

    Thread Starter YoChen

    (@piedro)

    Sorry to all who took the time reading!

    I simply had a typo!

    Add
    add_filter('the_content', 'strip_shortcodes');
    to your funcions.php and it works perfect.

    thx anyway,
    piedro

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to remove shortcodes from “the content”?’ is closed to new replies.