wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] How to change the login link class??


civilenggnotes
Posts: 23
Topic starter
(@civilenggnotes)
Eminent Member
Joined: 2 years ago

Hello,

I am using a pop up login plugin where i need to add class in link to trigger the pop up, like <a href="#Login" class="lrm-login lrm-hide-if-logged-in" > Login </a> to trigger pop up login when clicked on login text.

Now, in the User Authorization and Profile Data option in the setting i could found the login url, but don't know how to do that.

Please guide me regarding this..

Topic Tags
7 Replies
Asti
Posts: 3580
 Asti
Support
(@asti)
Support member
Joined: 4 years ago

Hi @civilenggnotes,

You should find all classes that are added on the popup window in the plugin and put it in the class attributes (the red marked codes are just an example, in your case, it may differ) in the code below: 

add_filter("wpdiscuz_login_link", function ($login) {
return str_replace(" href=", " class='swal-menu-item sw-open-login' href=", $login);
});

Put the code in the WordPress active theme functions.php file (more information how to add insert custom code):

Reply
6 Replies
civilenggnotes
(@civilenggnotes)
Joined: 2 years ago

Eminent Member
Posts: 23

@asti

Sorry.. i couldn't understand where to find and replace code.

Reply
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3580

@civilenggnotes,

Put the code in the WordPress active theme functions.php file. More information on how to add insert custom code you can find here: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

Reply
civilenggnotes
(@civilenggnotes)
Joined: 2 years ago

Eminent Member
Posts: 23

@asti

Thanks a lot.. I will try this and let you know if i face any other problems or it works..

Reply
civilenggnotes
(@civilenggnotes)
Joined: 2 years ago

Eminent Member
Posts: 23

hi @asti

i just added the code you provided, and make the necessary changes. but the problem I am facing now is that when I am clicking on the login link, it is getting refreshed with URL like example.com/test-post/?redirect_to=example.com/test-post and then again I need to click the login link. 

Please have a look at https://www.civilenggnotes.in/differences-between-tmt-bars-hysd-bars/

Reply
civilenggnotes
(@civilenggnotes)
Joined: 2 years ago

Eminent Member
Posts: 23

i add these lines in theme's function.php file.

add_filter("wpdiscuz_login_link", function ($login) {
return str_replace(" href=", " class='lrm-login lrm-hide-if-logged-in' href=", $login);
});

Reply
civilenggnotes
(@civilenggnotes)
Joined: 2 years ago

Eminent Member
Posts: 23

@asti

I guess it was some cache problem, which is now solved I guess.

Reply
Share: