-
AuthorPosts
-
June 5, 2021 at 5:54 pm #9544
usman tariq
Participanti want to change the title when a user logs in to his account for example, the initial text is “this is a widget” and when a user logs in the site the text changes to “welcome to the widget” is this possible?
any help will be appreciated. And thank you.June 7, 2021 at 2:44 pm #9564Aakash Chakravarthy
KeymasterHi Usman,
Sorry for the delay. I missed to reply for your query.
UFW provides an “box” where you can place “regular widgets”
So widgets are common. It does not matter whether it is in sidebar or UFW.
Below are my suggestions:
1) Find if there are any plugin which allows to change widget title as you need
2) Find/write custom code to change the title of your widget. Follow this link for an idea – https://wordpress.stackexchange.com/a/290010/3914 Here they are changin the title of recent posts widget.
3) Raise a topic in above forum and get some help on how to change the title for whatever widget on any criteria as you need.If you are trying to change the title of the “widget box” itself then that comes under UFW.
But right now there is no option to change the “widget box” title dynamically. I can share some code if needed which you need to edit.Thanks,
AakashJune 7, 2021 at 3:19 pm #9565usman tariq
ParticipantHi Aakash,
Sir first your plugins are awesome.
Second if you could share some code or guide me how to do this then do let me know. And i’m still looking other options and if i solve this i’ll let you know. Thank you.June 7, 2021 at 4:08 pm #9566Aakash Chakravarthy
KeymasterHi Usman,
I saw your website. Can yoh please confirm if you want to change “You need to login for Inquiry Cart” ?
If yes, then I can share code to change this after login.
Thanks
June 7, 2021 at 6:05 pm #9569usman tariq
ParticipantHi Aakash,
yes if it is possible then please do share the code with me. thank youJune 7, 2021 at 10:19 pm #9570Aakash Chakravarthy
KeymasterHi Usman,
Please go to plugin editor, select ultimate floating widget, select includes -> display.php
At line no 120, paste the following code.
if( in_array( $id, array( '3', '4' ) ) ){ $title = is_user_logged_in() ? 'My title when user is logged in' : 'Not logged in'; }
Here ‘3’, ‘4’ are the ID of the widget box for which you need to change. Replace that with your ID, add or remove IDs as needed like in the example.
Replace the title also as needed. First one is title when user is logged in. Second is when not logged in.
When the plugin upgrades, this changes will go.
I’ll provide a WordPress hook in the next version so that you don’t need to change it directly in the code. For now please use this.Thanks
June 9, 2021 at 3:16 pm #9577usman tariq
ParticipantDude thank you and the extension is awesome, plus its working fine.
June 11, 2021 at 11:14 pm #9593Aakash Chakravarthy
KeymasterHi Usman,
Happy that you got a solution !
Thanks,
Aakash -
AuthorPosts
- You must be logged in to reply to this topic.