Viber Channel
-
Is there any way to add a Viber Channel to the “Follow Us” widget?
-
Yes, check out the FAQ on how to add a custom follow button.
So, in other words, the answer is NO
Not without adding code to another plugin that has nothing to do with this plugin
- This reply was modified 3 years, 3 months ago by Frank.
And that code you referred me to doesn’t work
So that’s it then?
When you say it’s resolved, it’s resolved, even when it isn’t?To help people help you, provide details on how something “doesn’t work” for you and what you see & tried exactly.
Right now it’s unclear how the suggested code isn’t working for you, but you at least need to customize the example. To simplify the example code for Viber, you can use something like:
function addtoany_add_follow_services( $services ) { $services['viber'] = array( 'name' => 'Viber', 'icon' => 'viber', 'color' => '7C529E', 'href' => 'https://chats.viber.com/${id}', ); return $services; } add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );
After saving the code in Code Snippets (or similar), you should see Viber at the bottom when editing your AddToAny Follow widget and be able to insert your Viber channel name.
I added your code, modified with my settings
function addtoany_add_follow_services( $services ) { $services['example_follow_service'] = array( 'name' => 'Example Follow Service', 'icon_url' => 'https://www.example.com/my-icon.svg', 'icon_width' => 32, 'icon_height' => 32, 'href' => 'https://www.example.com/${id}', ); return $services; } add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );
On my website the image doesn’t appear. After a couple of seconds the image name pops up. So if you don’t know it’s there you won’t find it. If you click on it it opens viber in the browser and says the page is not found, instead of opening in viber. In the widget control panel the link to our viber channel appears under the box where we insert the URL.
Looking at the site in your profile, it looks like you only have Facebook, Twitter, Instagram follow buttons enabled right now. If you can, keep Viber enabled so we can take a closer look at what’s happening in the site’s HTML.
To make the Viber icon appear, use this code instead of the example code:
function addtoany_add_follow_services( $services ) { $services['viber'] = array( 'name' => 'Viber', 'icon' => 'viber', 'color' => '7C529E', 'href' => 'https://chats.viber.com/${id}', ); return $services; } add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );
Your Viber channel link, I believe, should be like this example:
https://chats.viber.com/fcbarcelonaSo if you’re
fcbarcelona
on Viber, insertfcbarcelona
into the custom Viber field in your AddToAny follow widget.THe site in question is https://kyivenglish.in.ua and the viber link is
https://invite.viber.com/?g2=AQAytT0egh3RBkkcc3X%2F2TXrOHgLggVQ5m8HnSwQc%2Fls%2FTtuDGka6CeGDYvC%2BTr3This code doesn’t work either. When I clicked on activate I got the following error
Don't Panic The code snippet you are trying to save produced a fatal error on line 73: is_readable(): open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s): (/var/www/frankf/data:.:/usr/local/stat) The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before. Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
Ah, that’s an error with the Code Snippets plugin, and it doesn’t seem to be related to the AddToAny code itself. I recommend posting a topic in the Code Snippets support forum that includes details such as the that error message + PHP code used.
Alternatively, if you’re comfortable with it, just add the PHP code to your theme’s
functions.php
file.We want to make custom services easier to add in a future update, so thanks for working with PHP code in the meantime.
Once you get the PHP code working, insert your whole
https://invite.viber.com/…
URL into the custom Viber field in your AddToAny follow widget.I don’t want to insert anything directly into a php file because I am sure I will have to do it every time the theme updates. I’ll let you know what Code Snippet says
Code Snippet says the problem is with your code, not their plugin
`I did look into this, but did not come to a definitive answer. I don’t think that this error is coming from Code Snippets itself, as it doesn’t have anything to do with writing to files, and the error is clearly coming from evaluated code, not from the plugin.
Having said that, the code you quote does not have a line 73, so I don’t see how it’s coming from there either. My best guess is that the snippet you quoted is not the one causing the issue, and you have a different snippet that calls is_readable() on line 73 of the code.`
So now everyone is passing the buck and nothing’s getting solved
ok, i got it working.
- The topic ‘Viber Channel’ is closed to new replies.