Кнопку VK вместо Pinterest

(Ответов: 3, Просмотров: 744)
  1. Творец Аватар для M_W
    • Регистрация: 01.05.2013
    • Сообщений: 1,107
    • Репутация: 294
    Прошу прощения, новый вопрос, адресованный к знатокам.

    Подскажите, как заменить вывод кнопки в этой теме - http://demo.tdwp.us/thebreakingnews/...ealthy-dinner/

    PHP код:
    <?php

    /**
     * Share buttons functionality
     *
     * @package thebreakingnews
     */
    function thebreakingnews_share_buttons() {
        global 
    $post;

        
    $current_url get_permalink();
        
    $current_title get_the_title();

        if( 
    get_the_post_thumbnail() ) {
            
    $currentImage wp_get_attachment_image_srcget_post_thumbnail_id$post->ID'large' ) );
        } else {
            
    $currentImage = array('');
        }

        
    $is_custom_style get_theme_mod'thebreakingnews_share_buttons_style''custom' );
        
    $share_butons_title get_theme_mod'thebreakingnews_share_button_title''Like? Share with your friends.' );

        
    $twitter_url 'https://twitter.com/intent/tweet?url='.urlencode$current_url ).'&amp;text='.urlencode(html_entity_decode($current_titleENT_COMPAT'UTF-8'));
        
    $facebook_url 'http://www.facebook.com/share.php?u='.urlencode$current_url ).'&amp;title='.esc_attr$current_title );
        
    $google_plus_url 'https://plus.google.com/share?url='.urlencode$current_url );
        
    $pinterest_url 'http://pinterest.com/pin/create/button/?url='.urlencode$current_url ).'&amp;media='.$currentImage[0].'&amp;description='.esc_attr$current_title );
        
    $linkedin_url 'http://www.linkedin.com/shareArticle?mini=true&amp;url='.urlencode$current_url ).'&amp;title='.esc_attr$current_title );
        
    $email_url 'mailto:?subject='.esc_attr$current_title ).'&body='.esc_url$current_url );

        if( 
    $is_custom_style === 'default' ){

            
    $output '<div class="share-section default-style">';

            
    $google_plus_share '<div class="g-plus" data-action="share" data-annotation="bubble"></div>';
            
    $google_plus_share .= '<script type="text/javascript">';
            
    $google_plus_share .= '(function() {';
            
    $google_plus_share .= 'var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;';
            
    $google_plus_share .= 'po.src = "https://apis.google.com/js/plusone.js";';
            
    $google_plus_share .= 'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);';
            
    $google_plus_share .= '})();';
            
    $google_plus_share .= '</script>';

            
    $in_share '<script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>';
            
    $in_share .= '<script type="IN/Share" data-counter="right"></script>';

            
    $facebook_share '<iframe src="//www.facebook.com/plugins/like.php?href='.esc_url$current_url ).'&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>';

            
    $twitter_share '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>';
            
    $twitter_share .= '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document, "script", "twitter-wjs");</script>';

            
    $pinterest '<a href="http://pinterest.com/pin/create/button/?url='.esc_url$current_url ).'&media='.$currentImage[0].'&description='.esc_attr$current_title ).'" class="pin-it-button" count-layout="horizontal">Pin It</a>';
            
    $pinterest .= '<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>';

            
    $email '<a href="'.$email_url.'" class="email">'.__'Email''thebreakingnews' ).'</a>';


            
    $output .= '<ul class="default-share-buttons"><li><div class="share-buttons-title">'.$share_butons_title.'</div></li><li class="facebook">'.$facebook_share.'</li><li class="twitter">'.$twitter_share.'</li><li class="google-plus">'.$google_plus_share.'</li><li class="in">'.$in_share.'</li><li class="pinterest">'.$pinterest.'</li><li class="email">'.$email.'</li></ul>';

        } else {

            if( 
    $is_custom_style === 'custom-icon' ){
                
    $output '<div class="share-section custom-style icons-only">';
            } else {
                
    $output '<div class="share-section custom-style">';
            }

            
    $output .= '<span class="share-buttons-title">'.$share_butons_title.'</span><!-- .share-buttons-title -->';
            
    $output .= '<a href="'.esc_url$facebook_url ).'" class="facebook"><span class="share-meta">'.__'Facebook''thebreakingnews' ).'</span></a>';
            
    $output .= '<a href="'.esc_url$google_plus_url ).'" class="googleplus"><span class="share-meta">'.__'Google Plus''thebreakingnews' ).'</span></a>';
            
    $output .= '<a href="'.esc_url$twitter_url ).'" class="twitter"><span class="share-meta">'.__'Twitter''thebreakingnews' ).'</span></a>';
            
    $output .= '<a href="'.esc_url$pinterest_url ).'" class="pinterest"><span class="share-meta">'.__'Pinterest''thebreakingnews' ).'</span></a>';
            
    $output .= '<a href="'.esc_url$linkedin_url ).'" class="linkedin"><span class="share-meta">'.__'LinkedIn''thebreakingnews' ).'</span></a>';
            
    $output .= '<a href="'.$email_url.'" class="email"><span class="share-meta">'.__'Email''thebreakingnews' ).'</span></a>';
        }

        
    $output .= '</div><!-- .share-section -->';

        echo 
    $output;
    }

    /**
     * Is share buttons on the top
     *
     * @package thebreakingnews
     */
    function thebreakingnews_is_share_buttons_top() {
        if( 
    get_theme_mod'thebreakingnews_share_buttons_top''1' ) ) {
            return 
    true;
        } else {
            return 
    false;
        }
    }

    /**
     * Is share buttons on the bottom
     *
     * @package thebreakingnews
     */
    function thebreakingnews_is_share_buttons_bottom() {
        if( 
    get_theme_mod'thebreakingnews_share_buttons_bottom''1' ) ) {
            return 
    true;
        } else {
            return 
    false;
        }
    }

    /**
     * Check if user wants to display share buttons on single pages
     *
     * @package thebreakingnews
     */
    function thebreakingnews_is_share_buttons_single_page() {
        if( 
    get_theme_mod'thebreakingnews_share_buttons_single_page''0' ) ) {
            return 
    true;
        } else {
            return 
    false;
        }
    }
    Расшаривающий юрл я заменяю таким образом:

    это - http://pinterest.com/pin/create/button/?url=
    на это - http://vkontakte.ru/share.php?url=

    Возникает трабла при нажатии - все слова заголовка лепятся в одно слово.

    И второй момент: как заменить саму картинку (цвет, лого) не того же Pinterest, а ВК или ОД?
    Качественный VPS | - за 3700 рублей в год || 2 Гб || 2000 МГц || 50 Гб || и не только
    • 0
  2. Творец Аватар для M_W
    • Регистрация: 01.05.2013
    • Сообщений: 1,107
    • Репутация: 294
    UP!
    Качественный VPS | - за 3700 рублей в год || 2 Гб || 2000 МГц || 50 Гб || и не только
    • -1
  3. Студент
    • Регистрация: 23.04.2015
    • Сообщений: 32
    • Репутация: 2
    M_W,\
    ну смотрите - картинки, наверно, прописаны в стилях:

    class="g-plus"
    class="twitter-share-button"

    и т.д.
    создайте новый стиль для кнопки вконтакте и поместите в него нужную картинку.
    • 0
  4. Творец Аватар для M_W
    • Регистрация: 01.05.2013
    • Сообщений: 1,107
    • Репутация: 294
    webapi, разобрался, все намного проще - в приведенном куске указан Unicode - через него шрифт FontAwesome и меняет картинки (лого), и, собственно, цвет подложки вручную уже не составляет труда.
    Качественный VPS | - за 3700 рублей в год || 2 Гб || 2000 МГц || 50 Гб || и не только
    • 0

Тэги топика:

Похожие темы

Темы Раздел Ответов Последний пост
Про Pinterest
Вопросы от новичков 1 16.04.2015 15:45
Нужен ли Pinterest?
Вопросы от новичков 8 30.10.2013 20:43
раскрутка профиля pinterest (ру зона)
Услуги по SMM, SMO 4 25.09.2013 01:59

У кого попросить инвайт?

Вы можете попросить инвайт у любого модератора:

Информеры