Hi Pharaoh145,
Yes, it is possible but you might need to choose two columns instead of three columns in my plugin options because part of the Facebook button messages go beyond of the column width. Or you might want to adjust the width of the columns. It all depends on your web page layout.
This is the solution that I offer you:
1. Open the header.php file located in your theme folder.
2. Add the following code after the body tag:
<?php my_body_function() ?>
3. Open the functions.php file located in your theme folder.
4. Add the following code after the <?php line:
remove_filter(‘get_the_excerpt’, ‘wp_trim_excerpt’);
add_filter(‘get_the_excerpt’, ‘custom_trim_excerpt’);
function custom_trim_excerpt($text = ”)
{
$raw_excerpt = $text;
if ( ” == $text ) {
$text = get_the_content(”);
$excerpt_length = apply_filters(‘excerpt_length’, 55);
$excerpt_more = apply_filters(‘excerpt_more’, ‘ ‘ . ‘[…]’);
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
//I’m assuming that your are putting my plugin in your front page but you can change the function “is_front_page” for another one depending on your needs.
if ( is_front_page() ) return ‘<div class=”fb-like” data-href=”‘ .get_permalink() .'” data-send=”true” data-width=”450″ data-show-faces=”true”></div>’ .$text;
else return apply_filters(‘wp_trim_excerpt’, $text, $raw_excerpt);
}
function my_body_function(){
do_action(‘my_body_function’);
}
add_action(‘my_body_function’,’add_facebook_sdk’);
function add_facebook_sdk(){
echo ‘<div class=”fb-root”></div>’.
‘<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/en_US/all.js#xfbml=1”;
fjs.parentNode.insertBefore(js, fjs);’.
“}(document, ‘script’, ‘facebook-jssdk’));</script>”;
}
Hope it works for you.