Show page element (gallery, in this case) only if user not logged in (2 posts)

  1. dainismichel
    Posted 6 years ago #

    This is something I'd like to be able to do in general, however, here is an example using the Featured Content Gallery.

    I placed this line of code in the right spot of my template's index.php file:
    <?php include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php'); ?>
    (shows the gallery)

    I know the WP funtion/logic to use:

    But, I don't know how to combine them to say:

    If the user is not logged in, then show the gallery.

    I could try to do something like this:

    $RandomNumber = rand(1, 2);

    if ($RandomNumber == '1') {
    echo 'The number was 1';
    } Else {
    echo 'The number was 2';

    and try to say if user not logged in, then string, if not, then do nothing...or, can I somehow only tell the include statement to include, if the user is not logged in.

    Assistance would be warmly appreciated, and I am willing to plow through some tutorials too...as long as they take me to the right goal :-)


  2. dainismichel
    Posted 6 years ago #

    include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php');

    from: the kind folks at:

Topic Closed

This topic has been closed to new replies.

About this Topic