Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • nevermind it works. I guess I just had to restart my computer.

    @randyhoyt
    I overwrote all of the original files with yours and it still does not work for me ??
    What could I be doing wrong?

    Thread Starter ethandt92

    (@ethandt92)

    your welcome! it looks like the plugin was just updated with manual features so my solution is no longer necessary

    Thread Starter ethandt92

    (@ethandt92)

    hey phirefly, I actually figured out how to do this but forgot to reply with my solution. What I did was create a duplicate and modified function within source.php, the file in the plugin’s folder, of the function rtsocial().

    You can see in rtsocial() that the if statements contain all the options such as horizontal, vertical, and its getting your settings from the $options array. I just removed any of the use of $options with the value I needed and removed the if statements and any social media buttons that I did not need, in my case that would be pinterest and some styles, such as icon and icon-count. Then I called it within my archive.php and single.php files where it was needed.

    1) Copy function rtsocial() into a new function called whatever you want. I called mine rtsocial_edit().
    2) Remove all if statements that you don’t need.
    3) Remove $options = get_option( ‘rtsocial_plugin_options’ ); and all uses of it in the function with the appropriate values.

    $options[‘display_options_set’] -> horizontal, vertical, etc
    $options[‘tw_handle’] -> your twitter account
    $options[‘tw_related_handle’] -> hashtags? I am not sure b/c I didnt use it and so I removed it entirely
    $options[‘fb_style’] -> like_light, like_dark, etc
    $options[‘active’] -> the order of the icon to be displayed as it is ksorted in the array $active_services, I used letters
    $options[‘alignment_options_set’] -> left, right, none, etc

    4) Call the function

    Below is an example:

    function rtsocial_edit() {
        //Working issue on attachment page
        if(is_attachment())
            return;
    
        global $post, $id;
    
        //Ordered buttons
        $active_services = array();
    
        //Twitter
            $tw = 'b';
            $tw_layout = '<div id="rtsocial-twitter-' . 'horizontal' . '">';
            $tw_layout .= '<div class="rtsocial-twitter-' . 'horizontal' . '-button"><a title= "' . esc_attr( get_the_title( $id ) ) . '" class="rtsocial-twitter-button" href= "https://twitter.com/share?via=' . 'twitteraccount' . '&related=' . '' . '&text=' . rt_url_encode( get_the_title( $id ) ) . '" target=\"_blank\" ></a></div><div class="rtsocial-' . 'horizontal' . '-count"><div class="rtsocial-' . 'horizontal' . '-notch"></div><span class="rtsocial-twitter-count"></span></div>';
            $tw_layout .= '</div>';
            $active_services[$tw] = $tw_layout;
        //Twitter End
    
        //Facebook
            $fb = 'a';
            $path = plugins_url( 'images/', __FILE__ );
            $class = 'rtsocial-fb-like-light';
            $rt_fb_style = 'fb-light';
    
            $fb_layout = '<div id="rtsocial-fb-' . 'horizontal' . '" class="' . $rt_fb_style . '">';
            $rt_social_text = 'Like';
            $fb_layout .= '<div class="rtsocial-fb-' . 'horizontal' . '-button"><a title="' . $rt_social_text . '" class="rtsocial-fb-button ' . $class . '" href="https://www.facebook.com/sharer.php?" target="_blank"></a></div><div class="rtsocial-' . 'horizontal' . '-count"><div class="rtsocial-' . 'horizontal' . '-notch"></div><span class="rtsocial-fb-count"></span></div>';
            $fb_layout .= '</div>';
            $active_services[$fb] = $fb_layout;
        //Facebook End
    
        //LinkedIn
            $lin = 'd';
            $summary = (strlen($post->post_content) > 100) ? wp_html_excerpt($post->post_content, 100) : $post->post_content;
            $lin_layout = '<div id="rtsocial-linkedin-' . 'horizontal' . '">';
            $lin_layout .= '<div class="rtsocial-linkedin-' . 'horizontal' . '-button"><a class="rtsocial-linkedin-button" href= "https://www.linkedin.com/shareArticle?mini=true&url='.urlencode(get_permalink($post->ID)).'&title='.urlencode(get_the_title( $post->ID )).'&summary='.$summary.'" target="_blank" ></a></div><div class="rtsocial-' . 'horizontal' . '-count"><div class="rtsocial-' . 'horizontal' . '-notch"></div><span class="rtsocial-linkedin-count"></span></div>';
            $lin_layout .= '</div>';
            $active_services[$lin] = $lin_layout;
        //Linked In End
    
        //G+ Share Button
            $gplus = 'c';
            $gplus_layout = '<div id="rtsocial-gplus-' . 'horizontal' . '">';
            $gplus_layout .= '<div class="rtsocial-gplus-' . 'horizontal' . '-button"><a class="rtsocial-gplus-button" href= "https://plus.google.com/share?url='.urlencode(get_permalink($post->ID)).'" target="_blank" ></a></div><div class="rtsocial-' . 'horizontal' . '-count"><div class="rtsocial-' . 'horizontal' . '-notch"></div><span class="rtsocial-gplus-count"></span></div>';
            $gplus_layout .= '</div>';
            $active_services[$gplus] = $gplus_layout;
        //G+ Share Button End
    
        //Sort by indexes
        ksort($active_services);
    
        //Form the ordered buttons markup
        $active_services = implode('', $active_services);
    
        //Rest of the stuff
        $layout = '<div class="rtsocial-container rtsocial-container-align-' . 'none' . ' rtsocial-' . 'horizontal' . '" >';
            //Append the ordered buttons
            $layout .= $active_services;
    
        //Hidden permalink
        $layout .= '<a title="' . esc_attr( get_the_title( $id ) ) . '" rel="nofollow" class="perma-link" href="' . get_permalink( $id ) . '" title="' . esc_attr( get_the_title( $id ) ) . '"></a></div>';
    
        return $layout;
    }

Viewing 4 replies - 1 through 4 (of 4 total)