Today we will talk about the component for Wordpress -
sexybookmarks version 3.0, namely, how to add the
VKontakte and
Odnoklassniki buttons to this plugin

For those who are not familiar with this plugin, I will explain that this plugin displays “social buttons” for publishing your articles to various services, such as “Facebook”, “Google bookmarks”, “Yandex bookmarks”, etc.
What is this particular plugin for? After all, for Wordpress, there are quite a lot of similar plug-ins ... In addition to the large number of built-in buttons (87 pieces), a pretty convenient settings panel and support for the Russian language, this plugin has an unusual design that can appeal not only to you, but also to your visitors.
')
Download
sexybookmarks plugin version 3.0, please click here:
sexybookmarks . Version 3.0. compatible with
Wordpress 3.3.1 , tested on their own experience.
The
sexybookmarks settings
panel opens in the Wordpress Options menu => SexyBookmarks. In the panel, you can mark the buttons of interest to you, add the attribute “rel = 'nofollow'” to the anchors, customize the placement of the button panel and customize the appearance. How the settings page looks like can be seen in the picture below.

.
This concludes the introductory part and turns to the main point - the topic of the article.
As mentioned earlier, the plugin includes 87 built-in buttons, but among them there are none of the most popular Odnoklassniki and VKontakte buttons in our area. Further on the text, I will explain how to add them, but for those who do not need to delve into the process of adding buttons,
at the end of the article there is a link to download the plugin with already built-in buttons.
Step 1
Copy the
sexy-vkontakte.png and
sexy-odnoklassniki.png icons for our future buttons to the
sexybookmarks \ images \ icons folder
Step 2
Open the
sexybookmarks \ includes \ bookmarks-data.php file and add the following lines to the end of the
$ sexy_bookmarks_data array:
'sexy-vkontakte' => array( 'check'=>sprintf(__('Check this box to include %s in your bookmarking menu', 'sexybookmarks'), __('VKontakte', 'sexybookmarks')), 'share'=>__('Share this on ', 'sexybookmarks').__('VKontakte', 'sexybookmarks'), 'baseUrl' => 'http://vk.com/share.php?url=PERMALINK&title=TITLE', ), 'sexy-odnoklassniki' => array( 'check'=>sprintf(__('Check this box to include %s in your bookmarking menu', 'sexybookmarks'), __('Odnoklassniki', 'sexybookmarks')), 'share'=>__('Share this on ', 'sexybookmarks').__('Odnoklassniki', 'sexybookmarks'), 'baseUrl' => 'http://share.yandex.ru/go.xml?service=odnoklassniki&url=PERMALINK', ),
This code will add 2 buttons to the component settings panel and to the page that your visitor will see.
Let me explain some points on the code:
'check' - displayed in the tooltip button in the settings panel
'share' - displayed in the tooltip button on the page with the component
'baseUrl' is the url pattern for the button, where
PERMALINK and
TITLE are metacharacters.
Step 3
Open the file -
sexybookmarks \ includes \ public.php . Find the function “
function get_sexy () ” in the switch, add the case:
case 'sexy-vkontakte': $socials.=bookmark_list_item($name, array( 'permalink'=>urlencode($perms), 'title'=>$title, )); break;
A small lyrical digression regarding the service "Odnoklassniki"As practice has shown, the publication service in Odnoklassniki is quite capricious, and if the url of your page includes Cyrillic letters, like for example:
my-site.com/ hello- world , then when publishing a link, the error “
No access to the resource ”

Step 4
In principle, the three previous steps are already quite enough to ensure the operability of the component. Well, the most inquisitive can go further.
So, according to the results of the previous three steps, we have already placed the buttons in the admin panel and they are displayed in your notes. But on the settings panel, instead of the Odnoklassniki and VKontakte icons, the icon shown in the figure below is displayed.

In order to correct this situation, open the file with styles for the admin panel:
sexybookmarks \ css \ admin-style.css and add the styles:
label.sexy-vkontakte{ background: url('../images/icons/sexy-vkontakte.png') no-repeat; background-repeat: no-repeat; cursor: move; float: left; height: 40px; margin: 12px 2px !important; text-align: center; width: 60px;} label.sexy-odnoklassniki{ background: url('../images/icons/sexy-odnoklassniki.png') no-repeat; background-repeat: no-repeat; cursor: move; float: left; height: 40px; margin: 12px 2px !important; text-align: center; width: 60px; }
Step 5
In the tooltip buttons on the page and the settings panel the text is displayed in Latin letters - “Odnoklassniki” and “VKontakte”. If you are not satisfied with this situation, then these buttons can be localized for the Russian language.
To set up localization you will need the
Poedit utility.
Localization files are located in the
sexybookmarks \ languages ​​\ folder. These are files with extensions:
"* .po" ,
"* .mo" and
"* .pot" . In the file "* .po" - localization variables are described, then these files are compiled into "* .mo" files.
Editing "* .po" fileRun poedit.exe open the file of resources of the Russian language -
<directory with plugin> \ sexybookmarks \ languages ​​\ sexybookmarks-ru_RU.poConfigure the path to the directory with the plugin (“Directory” => “Settings ...”), select the “Paths” tab. In the field “Path to base” enter the path to the folder with the source code of the
sexybookmarks plugin

Synchronize with source codes (“Catalog” => “Update from source code”)
Ask a translation for "VKontakte" and "Odnoklassniki"
Compiling "* .mo" fileNow it remains to do the last thing - compile “* .po” - file to “* .mo” - file. You can do this on the command line.
"C:\Program Files\Poedit\bin\msgfmt.exe" -o C:\___\sexybookmarks\languages\sexybookmarks-ru_RU.mo C:\ ___ \sexybookmarks\languages\sexybookmarks-ru_RU.po
In response, usually, nothing is written, just the “* .mo” file is updated.
That's all! Thanks to everyone who mastered, I hope that my article was useful to you.
Download link for sexybookmarks plugin with VKontakte and Odnoklassniki buttons:
depositfiles:
sexybookmarks