Check for wait for images plugin

Checks for Wait for Images plugin before and adds the code if the
function doesn't exist.