You get XP for ranking up in two ways:
- Getting a star in a Training Mission (higher medals give more XP, but the XP is non-repeatable and doesn't "add up" with higher medals - as in, getting a bronze, silver then gold will give you the exact same amount of XP as just getting gold).
- Playing online multiplayer games. Playing offline multiplayer does not get you XP.
You can get to rank 10, though, without ever playing online multiplayer - there's more than enough XP contained within the Training Missions, as long as you get a fair amount of gold stars. With that in mind, the best course of action is to get as many gold stars in the Training Missions before boosting to rank 20.
If you're boosting the "Bling" achievement, you don't have to worry about focusing on XP. You will be playing a number of matches where only you get a bunch of kills, so you'll get a large amount of XP. If you and your boosting partner have extra controllers, sign them in as guests to play a 4 player game - this will make both XP boosting and badge boosting MUCH quicker.
Lastly, it should be noted that the 8 Training Missions added within the 2 DLCs give you XP for getting stars in them too. You only need to gain bronze for those DLC pack's achievements, but try to aim as high as you can if you want the extra XP boost.