• Resolved maringorama

    (@maringorama)


    hello all.

    the article itself displays fine. (i obfuscated an email), but somehow the excerpt produced by this article has a display error:

    this is the archive and this the search result

    does this have to do with the email-obfuscation i used
    or with an error in archive.php and search.php ?

    and, another question:
    this search result displays as second hit a PAGE – how can i avoid that ?

    thank you for your help !

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yeah it looks like the email is getting messed up when being posted through the_excerpt. Usually the_excerpt strips tags. You can try finding a plugin for the excerpts that allows html

    Thread Starter maringorama

    (@maringorama)

    well yea, actually it looks like the EXCERPT is messing up the links in a post !!!
    look, there is another post in the archive further down (“institutions”), with links in it, from which the full article looks like this.

    is this normal for WP ? any idea how i can get around this ?

    Thread Starter maringorama

    (@maringorama)

    right, i found this very useful link for CUSTOMIZING THE EXCERPT without any plugin, simply via the functions.php .

    thing is, it does not seem to work the way i changed the code for me,
    still not showing any links… grrrrr.. WHY ???

    function improved_trim_excerpt($text) {
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$text = strip_tags($text, '<a>');
    		$excerpt_length = apply_filters('excerpt_length', 40);
    		$excerpt_more = apply_filters('excerpt_more', ' ' . ' . . . . ');
    		$words = explode(' ', $text, $excerpt_length + 1);
    		if (count($words) > $excerpt_length) {
    			array_pop($words);
    			$text = implode(' ', $words);
    			$text = $text . $excerpt_more;
    		}
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');
    Thread Starter maringorama

    (@maringorama)

    well, i managed to make this work this way:

    1.) there was a conflict with the THUMBNAIL FOR EXCERPTS plugin. i deleted it.
    2.a) to make use of the built in thumbnail function in WP i added the following to the functions.php:

    // Add excerpt thumbnail
    if ( function_exists( 'add_theme_support' ) )
    add_theme_support( 'post-thumbnails' );

    2.b) and i added some more code to the loop:

    <div class="post-content">
    <?php the_post_thumbnail('thumbnail'); ?>
    <?php the_excerpt(); ?>
    </div>

    3.) and for the manipulation above i changed it to:

    function improved_trim_excerpt($text) {
     	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$text = strip_tags($text, '<a><p><strong><em>');
    		$excerpt_length = apply_filters('excerpt_length', 70);
    		$excerpt_more = apply_filters('excerpt_more', ' ' . ' . . . . ');
    		$words = explode(' ', $text, $excerpt_length + 1);
    		if (count($words) > $excerpt_length) {
    			array_pop($words);
    			$text = implode(' ', $words);
    			$text = $text . $excerpt_more;
    		}
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');

    I found these snippets at kremalicious and aaronrussell – thank you guys ??

    I AM STILL HAVING TROUBLES DISPLAYING THE OBFUSCATED EMAIL !!!
    i tried adding the mailto: tag — no changes .. ??

    Thread Starter maringorama

    (@maringorama)

    ok, i found out that the excerpt bugged with a certain way of obfuscation … ??

    i now use this obfuscator, and it works ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘excerpt or archive / search error ?’ is closed to new replies.