Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Forum: Plugins
    In reply to: Email Newsletter Plugins
    Thread Starter itsumishi

    (@itsumishi)

    Thanks a bunch.

    Thread Starter itsumishi

    (@itsumishi)

    As I said.
    I’m sure there is a more elegant and flexible solution but this has served it’s purpose for myself.

    I don’t upgrade as a matter of course anyway. If the page is working and serving it’s purpose why upgrade unnecessarily. Of course if new features come about that I feel are worth upgrading for then I will, I will also add the 21 characters of code back into this page to fix things.

    Thread Starter itsumishi

    (@itsumishi)

    Hi everyone

    After a lot of fiddling around today I’ve worked out a solution that’s worked for me. It might need a bit of customising if anyone else wants to use it depending on how they format the posts.

    Firstly I’ve opened the wp-includes/formatting.php file and found the following snippet of code.

    * @param string $text The exerpt. If set to empty an excerpt is generated.
     * @return string The excerpt.
     */
    function wp_trim_excerpt($text) {
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$text = strip_tags($text);
    		$excerpt_length = apply_filters('excerpt_length', 55);
    		$words = explode(' ', $text, $excerpt_length + 1);
    		if (count($words) > $excerpt_length) {
    			array_pop($words);
    			array_push($words, '[...]');
    			$text = implode(' ', $words);
    		}
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }

    Apparently you can copy this piece of code and paste it into your theme’s ‘functions.php’ file but I couldn’t get this to work (I think because I have my excerpts on a seperate page that is not directly linked to my wordpress blog and therefore probably skips the themes.

    I ended up changing the code in the original formatting.php file.

    I simply added
    $text = strip_tags($text, '<div>, <ul>, <li>');

    Then on my style sheet I added display:none; to the divs (and the ul and li) items that I wanted hidden. I found this has made my excerpts look a lit tidier.

    I’m sure there is a more elegant and flexible solution but this has served it’s purpose for myself.

    Thread Starter itsumishi

    (@itsumishi)

    Anyone have any ideas?

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