In case of a total electrical failure, the aircraft can still be controlled using rudder pedals and manual pitch trim.
The airbus EFCS (Electronic flight control systems) are configured as below:
Airbus EFCS; Image from smartcockpit.com
From Airbus Flight Control Laws:
MECHANICAL BACKUP
In case of a complete loss of electrical flight control signals, the aircraft can be temporarily controlled by mechanical mode.
Pitch control is achieved through the horizontal stabilizer by using the manual trim wheel.
Lateral control is accomplished using the rudder pedals.
Both controls require hydraulic power.
The A340 also seems to have a similar system. From the A340 Flight Deck and Systems Briefing for Pilots:
Mechanical back-up
• To sustain the aircraft during a temporary complete loss of electrical power.
• Longitudinal control of the aircraft through trim wheel. Elevators kept at zero deflection.
• Lateral control from pedals. Roll damping is provided by the Back up Yaw Damper Unit (BYDU).
A340 mechanical Backup system; image from A340 Flight Deck and Systems Briefing for Pilots
Note that this is given only as a temporary measure. Also, See How are fly-by-wire airliners controlled in case of complete electrical failure? and How does the Airbus flight computer's voting system work?