Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #802787

    Hi,
    I’m getting crazy to solve this issue:
    I’ve created a tabbed content area and I would like to hide it when a user is logged in.

    My purpose is to hide the tab (in the tab menu and its content) once a user is logged in.

    The tab ID is “registration-tab” and the tab is the number 4 named “#user login”.
    I understand that the space used in the tab name won’t work… so I renamed it only #log-in

    Using function.php this is my snippet:

    function professional_tabs_function() {
    if ( is_user_logged_in() ) {
    echo ‘<div id=”registration-tabs#log-in” style=”display:none!important;”>’;
    } else {
    }
    }
    add_action( ‘loop_start’, ‘professional_tabs_function’ );

    It doesn’t work…

    Please, could you help me to solve this headache?
    Many thanks in advance!!!

    #802962

    Hey Dario,

    So you only want to hide an element if the user is logged in? If so you should be able to do so with simple CSS:

    .logged-in #log-in {
      display:none;
    }

    Best regards,
    Rikard

    #802990

    Hi Rikard,
    it doesn’t work. I tried this solution before adding the !important as well.

    My purpose is to remove the TAB and its content, and not to hide its content.
    So, I understand that each tab has a # that works with it.
    There are several problems:
    1. When I use a title for a tab with spaces, it doesn’t work at all (i.e.: tab name = Log In = #log in)
    2. I open another ticket because this issue cause a severe problem using the tags in Firefox (it doesn’t work)
    3. How can I remove it using instead a php code as function… I think that it can works better

    Please, help!
    Many thanks in advance.

    #804698

    Hi,

    Your code has some stuff correct but it is not complete.
    You can use Rickard code, under a is_login into your header, which will hide the tab, when the user is loged in and it will show the CSS rules.

    Best regards,
    Basilis

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.