That’s where some conditional PHP comes in along with GP Hooks, part of the GeneratePress Premium add on.
The second example shows an AnyWhere Elementor template shortcode.
Remember to tick the Execute PHP checkbox.
Note: the links in this post are NOT affiliate links. However, the items in the right sidebar are 🙂