Forums

filter text within [code] on archive (2 posts)

  1. mangavalk
    Member
    Posted 10 months ago #

    i want to filter the text within [code][/code] tags on my archive and catagory pages, i found something with the the_excerpt, but i dont know howto use it.

    is there somebody that can explain to me how i can achieve this ?

  2. s_ha_dum
    Member
    Posted 10 months ago #

    It is too late in the day for me to test this but something like this might work:

    add_filter('the_excerpt', 'strip_shortcodes');

    You would put that in your theme's functions.php file.

    If it does work, you will remove all of the shortcodes anywhere the the_excerpt function is used, so it may do more than you want. You might want to fine tune it with a function similar to the one here, but with a different logic: http://codex.wordpress.org/Function_Reference/strip_shortcodes#Strip_shortcodes_on_home_page_but_not_on_single_or_archive_pages

Reply

You must log in to post.

About this Topic

Tags

No tags yet.