The only thing different you're describing is plugging in the truck. If that's the case, then the electrics on the trailer are receiving 12 volt power from the truck.
If the electrics all work with the truck plugged in, and do not with the truck unplugged, it follows that there is no power source available when the truck is not plugged in.
So, either the trailer's battery, regardless of age, is dead, or the battery is good, but there is no connection between the battery and the fuse panel.
To find out, you will need a test light or a voltmeter. First, disconnect the truck and unplug any shore power to your trailer. Next shut off anything that draws 12 volt power.
Start testing at the fuse panel. Use your meter or test light to verify that there is no power at the panel.
A voltmeter is preferred, but a test light will work OK, just not as accurate. If the test light shows power at the fuse panel or at the battery, have a helper turn on something that draws current, it doesn't matter what. If the test light goes out or the voltage plunges several volts, suspect a badly corroded connection or a failed battery. If there is no power, or the power dies under a load, next check directly at the battery.
Don't check at the battery cables where they attach to the battery, but at the posts of the battery itself. If there is no power here, remove the battery and have it charged and then tested.
If the battery shows power (12 volts on your meter, or lights the test light), then check at the cables where they connect to the battery.
This will identify any oxidized connections which can prevent the battery from supplying power to the cables. If there is power at the battery, but not to the cables, remove the cables and clean the battery posts and the cables where they contact the posts until you see bright shinny metal on both. Add some grease or anti corrosion compound on the posts and reconnect them, then double check for power through the cables and continue testing all connections between the battery and the fuse panel.
I hope this helps.
Mike D