Custom excerpt function re-factoring

I’d simply set a flag as second input argument for the function:

function new_wp_trim_excerpt( $text, $case="plain" ) 
{
    switch ( $case ) 
    {
        default :
        case 'plain' :
            // do stuff - your function so far
            break;

        case 'image' :
            break;
    }
}

Notes:

  • Avoid names like class="moarplz". It’s hard to read for others and hard for yourself in a year.
  • Never count inside an if/for/while/foreach/else/elseif statement – it’s up to 5 times slower than counting it in the line before.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)