Remove Shortcodes on Archive page

Community Forums Forums Design Tips and Tricks Remove Shortcodes on Archive page

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  TDogger 2 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8444

    elliott
    Participant
    Post count: 1

    Shortcodes are displaying as text on my blog archive pages in the summary. I have attempted to add the code below to the Functions.php for my Crystal Theme, however nothing I am trying is working. Anybody got any ideas?

    You can see the shortcode [HTML1} on the third post down on this page http://labaumemusic.com/category/portfolio/

    I have also tried: ” is_archive” “is_page_archive” “is_blog” “is_page_blog”

    CODEX – Function Reference/strip shortcodes – see below:

    function remove_shortcode_from_index($content) {
    if ( is_archive() ) {
    $content = strip_shortcodes( $content );
    }
    return $content;
    }
    add_filter(‘the_content’, ‘remove_shortcode_from_index’);

    #15096

    SoZo
    Moderator
    Post count: 1573

    You could enter custom excerpts


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #15701

    elliott
    Participant
    Post count: 1

    I do not know how to do that, can you provide an example of what you mean to exclude the short code [HTML1] from showing up as stated above?

    #126596

    TDogger
    Member
    Post count: 23

    I just ran into the same problem with the News Pro theme version 3.0.2. Shortcodes for an advertising plugin are displaying on the Archive pages.

    Does anyone have a solution?

    I tried elliot’s code and it doesn’t work for me, either.

    #126673

    TDogger
    Member
    Post count: 23

    The function that elliot found does work. I can apply other changes to the $content variable and they do display on the post. However, the strip_shortcodes function is not working. I cannot remove the shortcodes even if I apply the filter to all pages and posts.

    Does anyone know how to re-enable strip_shortcodes?

    • This reply was modified 2 months, 2 weeks ago by  TDogger.
    • This reply was modified 2 months, 2 weeks ago by  TDogger.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.