If you are in the U.S. under a visitor status with a true intent to stay for a temporary period and then return home, based upon an actual visa stamp in your passport, and not the visa waver program, you can apply for adjustment in the U.S. by filing an Application I-485. If you are entering the U.S. on the visa waiver program the best approach for you is to proceeded through the U.S. Consulate for the conditional permanent residency visa.
You can only adjust upon an approval of the I-526 petition, not before. That is, the approval gives you the basis for filing the I-485. If you can arrange your travel timeline to be in the U.S. upon I-526 approval (which may be difficult because of unpredictable USCIS processing time), then you can move forward with adjustment instead of consulate processing. It is best to retain experienced US Immigration counsel to create an immigration strategy and assist you with the process.