egor maltsev
asked 5 years ago

Hi.

Can you help me to add share link to vkontakte (vk, vk.com, вконтакте) to the left share bar (screenshot)?

I find old thread about this and they say that needed to add new variable to function dw_focus_post_actions() at function.php, but my custom function.php does’nt have "dw_focus_post_actions()"

Thank you a lot!

1 Answers
Allen
answered 5 years ago

@egnor maltsev : hi , in the latest update dw_focus 1.2.6 , we didn’t use the function dw_focus_post_actions anymore.Instead of that , we use another function name : "dw_focus_entry_sidebar" in file : dw-focus\inc\template-tags.php:
First , you go to line 29 , below there , you add this function( to count the share of the post ) :

if (! function_exists('dw_get_vk_share_count')){
    function dw_get_vk_share_count($url) {
    $tempvk = file_get_contents( 'http://vk.com/share.php?act=count&url=' .$url);
    $tmpvk = array();
    preg_match( '/^VK.Share.count\(0, (\d+)\);$/i', $tempvk, $tmpvk );
    $tempvk_count = $tmpvk[1];
    return isset( $tempvk_count ) ? $tempvk_count : 0;
    }
 }

After that , in function dw_focus_entry_sidebar():
_At the first line of function add this code :

<?php $vk_count = dw_get_vk_share_count( get_permalink() );  ?>

_below the line : <li class="list-group-item"><span id="linkedin" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-title="Linkedin"></span></li>
add these code :

<li class="list-group-item">
                    <span id="vk-com">
                        <div class="box"><a class="count" href="#"><?php echo $vk_count ?></a><a class="share" href="http://vkontakte.ru/share.php?url=<?php the_permalink(); ?>"><i class="fa fa-vk"></i>VK.Com</a></div>
                    </span>
                </li>

Hope this help.
Because in this version , we use shareee.com plug-in , and it’s not support vk.com. Then, when you click vk.com share button, it’ll not have a popup window, i’ll redirect you to another page. if you want that pop-up window , you need add some java script to trigger it. Glad.

egmalt
replied 5 years ago

Work great, thanks!

But why this sidebar does’nt build in another post template – http://joxi.ru/qVrwvXNigE6QAX ? There are no styles! May be it another custom post?

nobita
replied 5 years ago

@egor maltsev: hi i think we already have styles for that like demo here : http://demo.designwall.com/dw-focus/time-to-get-tough-with-north-korea-and-iran-as-imminent-nuclear-bomb-test-looms/,
But the Vk share is not supported so about the Vkshare , it’s like custom code. You can send me your site link , i’ll check the style for you.

nobita
replied 5 years ago

@egor maltsev : and this style only work in a single page. ( with clas ".single" in the body tag ).

egmalt
replied 5 years ago

Nobita, thanks!

You can send me your site link , i’ll check the style for you.
Thanks you, but don’t care! I plug them by self)
and this style only work in a single page. ( with clas ".single" in the body tag ).
I try to copy original styles, i think it would be easy)

Powered by DW Question & Answer Pro