Switch Elements for Logged In Users

Get the latest from
Sniffle Valve

Sniffle Valve

Consider buying Sniffle Valve a coffee  

Book a one-on-one online training session

Note: To copy any code presented in these tutorials, hover over the code and select the Toggle RAW Code icon raw code icon

Allows you to switch header, footer, etc. for users who are logged in.

Add the PHP code below into the desired GeneratePress Premium GP Hooks location. Don’t forget to tick the Execute PHP checkbox.

This example is using the shortcode from the AnyWhere Elementor plugin. If you have Elementor Pro, you can use that with the shortcode in the format of Substitute XXX with your IDs.

if ( is_user_logged_in ( ) ) {
    echo do_shortcode( '[INSERT_ELEMENTOR id=XXX]' ); 
} else {
    echo do_shortcode( '[INSERT_ELEMENTOR id=XXX]' );

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top