Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Not wanting to mess about with the plugin, I did this on the font end instead.

    // regular expression:
    $matchSrc = "/src=[\"' ]?([^\"' >]+)[\"' ]?[^>]*>/i" ;
    // get the <img src="... from the plugin, via one on various methods explained in the documentation...
    $avatar = get_avatar($user->ID, 64); // for example
    // preg match to extract the src= bit
    preg_match($matchSrc, $avatar, $matches);
    $theImageUrl = $matches[1];

    That gives you everything between src=”[…]”.

    I wanted to use it for the background of a div…

    echo "<div style='background:url($theImageUrl) center no-repeat;'>";

    I hope it helps 🙂

    Forum: Fixing WordPress
    In reply to: topic of the week
    Thread Starter eddyfly

    (@eddyfly)

    Thank you. This looks like it will be very useful starting point.

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