-
AuthorPosts
-
November 5, 2016 at 7:49 pm #708735
using this:
add_action('ava_inside_main_menu', 'avia_add_forms_on_header'); function avia_add_forms_on_header() { echo '<span class="avia-bullet"></span><span class="avia-menu-text" style="font-size: 8px; position: relative; width: 100px;">LOGGED IN AS: EDWARD</span>'; }
in my child-theme, I am able to get a logged in as statement, but the formatting is all wrong. I want it to look like part of the menu. Is there a better way to do this? Don’t worry about the logic of username. I understand that. I am only concerned about how it looks.
November 7, 2016 at 4:45 pm #709354Hey ec1warc1,
Please add following code to Fuctions.php file in Appearance > Editor
function avia_loggedin_user(){ $user = wp_get_current_user(); if(is_user_logged_in()){ $output = "LOGGED IN AS: " . $user->display_name; return $output; } } add_shortcode( 'av_user_info', 'avia_loggedin_user' ); function remove_title_attr(){ ?> <script> jQuery(window).load(function(){ jQuery('.loggedin-user').removeAttr('href'); }); </script> <?php } add_action('wp_footer', 'remove_title_attr');
Then please go to Appearance > Menu and then check “Screen options” on the top right side and then check “CSS Classes”. After that, add a new Custom Link with # for url and [av_user_info] for navigation label. Then give it a custom CSS class “loggedin-user” and add following code to Quick CSS in Enfold theme options under General Styling tab
.loggedin-user { display: none; } .logged-in .loggedin-user { display: block; }
Best regards,
YigitNovember 14, 2016 at 12:50 am #711725OMG, it worked….
One more observations to make this solution a little bit better:
If I click on a different tab of the same browser, then go back to that tab, the “LOGGED IN AS: USERNAME” disappears. Is there something we can do to prevent that from happening?Anwyay…. this is an amazing solution and I really thank you!
November 14, 2016 at 12:55 am #711726Wait a minute… I spoke too soon
November 14, 2016 at 11:11 pm #712206Hi,
You are welcome :)
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
Login credentials include:
- The URL to the login screen.
- A valid username (with full administration capabilities).
- As well as a password for that username.
- permission to deactivate plugins if necessary.
Best regards,
YigitNovember 16, 2016 at 9:33 pm #713196I want to thank you for your help, as usual… so awesome. Anyway… I will put the instructions in the private data, you can take a look.
November 16, 2016 at 10:06 pm #713215As long as I have your attention, can I add another related question… the “logged in as” is rather long. I would like to shorten it up and make it happier by using a smiley like you see here (shown as is, and how it could improve):
Again, thank you so much for the assistance. Best wishes, ec1warc1
November 17, 2016 at 4:56 am #713341ok, I was able to get an image in place of the text “Logged in as” – some sizing and styling needs to be considered, but I can do that. The only issue that remaing is why the link disappears from certain pages if you click on a tab of some other site (unfocus?) and then return. The link with the username disappears. Odd behavior considering the fact that that it is true for some pages only. I would bet it has to do with something on the page. <body> tag perhaps.
November 20, 2016 at 8:44 am #714429Hi,
This css code in the Quick CSS field removes the item.
.loggedin-user { display: none; }
Best regards,
IsmaelNovember 20, 2016 at 6:20 pm #714562OMG, that fixed it. I just commented out that line and the problem went away. I don’t understand why that line was included in the original instructions. It doesn’t matter now! It works! THANK YOU! SMILES FROM COLOMBIA! CLOSE THIS TICKET!!!!
November 20, 2016 at 8:41 pm #714576Hi,
You are welcome!
For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
For any other questions or issues, feel free to post them here on the forum and we will gladly try to help you :)Enjoy your weekend!
Regards,
Yigit -
AuthorPosts
- The topic ‘I want to include a logged in as in the menu’ is closed to new replies.