• Resolved 1-jah

    (@1-jah)


    The site is currently still under development and I did not put it at a development folder, I apologize for that. But what I’m asking is surely nothing more than codes I need for my child theme.

    I’m trying to do a redirect on a membership site and what I need is for the header of the site to redirect to a member’s only area if the user is logged in. If they are logged out it can go to the normal home page made for the visitors.

    In the theme I’m working with this is the code being used for the header,

    case 'Clickable header image' :
    			echo '<a href="' . esc_url( home_url( '/' ) ) . '" id="linky"></a>' ;

    I know some of the php queries such as

    <?php
    function switch_homepage() {
        if ( is_user_logged_in() ) {
            $page = 2516; // for logged in users
            update_option( 'page_on_front', $page );
            update_option( 'show_on_front', 'page' );
        } else {
            $page = 2; // for logged out users
            update_option( 'page_on_front', $page );
            update_option( 'show_on_front', 'page' );
        }
    }
    add_action( 'init', 'switch_homepage' );
    ?>

    However, I’m not completely sure how to use it. Anyone that can help I will be more than grateful!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Header image redirect’ is closed to new replies.