如何根据某些条件调用不同的WP页面?

Let's say I have a page A and a page B that I created with the Wordpress dashboard. I have written a function in function.php that basically return 1 or 0 depending on whether the user succesfully logged in or not. How can I code that I want page A to be built if I got 1 or page B if I got 0 ?