Is it safe and within code (1970 US) to permanently wire a 20' cord to a garage door opener?
Both an extension cord and a properly-installed replacement cord (possible built from an extension cord) are viable, temporary solutions in my experienced but unlicensed opinion. You will not overload a 14 gauge cord with a typical 1/3 or 1/2 hp opener. (I'd avoid the lighter 16 gauge cords even if your current plug cord is 16 gauge--you're adding length.) 

These solutions will probably not meet building code and will not have UL approval. If it was my home, I'd disregard those things in your situation.

In either case, secure the cord such that it's not likely to be damaged. That's the primary concern with exposed wiring of any kind.