-
AuthorPosts
-
June 1, 2017 at 10:02 pm #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-inUsing 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!!!June 2, 2017 at 12:15 pm #802962Hey 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,
RikardJune 2, 2017 at 1:05 pm #802990Hi 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 betterPlease, help!
Many thanks in advance.June 6, 2017 at 9:46 pm #804698Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.
