• I have one problem I use this function for truncate posts

    function truncate_post($amount,$quote_after=false) {
    	$truncate = get_the_content();
    	$truncate = apply_filters('the_content', $truncate);
    	$truncate = preg_replace('@<script[^>]*?>.*?</script>@si', '', $truncate);
    	$truncate = preg_replace('@<style[^>]*?>.*?</style>@si', '', $truncate);
    	$truncate = strip_tags($truncate);
    	$truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' '));
    	echo $truncate;
    	echo "...";
    	if ($quote_after) echo('');
    }

    but in my posts there is wordpress gallery call

    [gallery ids="614,592,591"]

    And now I need this truncate to not calculate this gallery tag.. because I get empty fields.. is this can be done? to truncate just text…

  • The topic ‘truncate post with gallery tag’ is closed to new replies.