0

How to add custom HTML class to "Sign Out" button in magento2

enter image description here

1

You can add class using jQuery also. Create one custom JS file and include it in section. Add below code in your JS file:

require(['jquery'], function ($) {
    $(document).ready(function () {
      $(".authorization-link a").addClass("sl-custom-class");
    });
});
  • Thank you works – Jaisa Apr 10 '20 at 14:07
1

May be help you . /Magento_theme/templates/html/header.phtml

<?php 
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->create('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) : ?>
    <span class="header_account_link_list logout">
        <a class= "header_account_link" href="<?php echo $this->getUrl("customer/account/logout");?>"><?php echo __('Logout')?></a>
    </span>
<?php else: ?>
    <span class="header_account_link_list login">
        <a class= "header_account_link" href="<?php echo $this->getUrl("customer/account/login");?>"><?php echo __('Sign in')?></a>
    </span>
<?php endif;?>

And more information link :-

https://community.magento.com/t5/Magento-2-x-Programming/Magento2-3-add-custom-login-and-logout-button/td-p/121047

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.