Mis-alignment of Social icons due to change post Title Length
#1
Posted 09 February 2012 - 07:44 AM
#2
Posted 09 February 2012 - 09:31 AM
#3
Posted 09 February 2012 - 05:34 PM
#4
Posted 09 February 2012 - 05:45 PM
#5
Posted 09 February 2012 - 09:08 PM
add_action( 'the_post', 'after_post_title_social_front');
function after_post_title_social_front () {
if (is_home()) { ?>
<div class="buttons-home" align="right";>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=90& action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px;"></iframe>
<!-- Begin Twitter Button -->
<script src="http://platform.twitter.com/widgets.js"; type="text/javascript"></script>
<a href="http://twitter.com/share"; class="twitter-share-button"
data-url="<?php the_permalink(); ?>"
data-via="JAlLBREAKS"
data-text="<?php the_title(); ?>"
data-count="horizontal">Tweet</a>
<!-- End Twitter Button -->
<g:plusone size="medium" href="<?php the_permalink(); ?>"></g:plusone>
</div>
<?php }
}
CSS to align the buttons
/*Social Buttons Alignment at HomePage*/
.buttons-home {position: relative;top: 7.5em;}
#6
Posted 10 February 2012 - 03:43 AM
<div class="buttons-home" align="right";>
^ Please remove the semilcolon that follows "right" in this code.
#7
Posted 10 February 2012 - 04:37 AM
#8
Posted 10 February 2012 - 02:40 PM
But anyway, this filter does the job:
add_filter( 'continue_reading_link_text', 'after_post_title_social_front' );
function after_post_title_social_front () {
if ( !is_home() )
return;
global $post;
$link = sprintf(
'<a class="continue_reading_link" href="%s" title="%s %s">%s</a>',
get_permalink(),
__("View", 'pagelines'),
the_title_attribute(array('echo'=> 0)),
ploption( 'continue_reading_text' )
);
$buttons = sprintf( '
<div class="buttons-home">
<iframe src="http://www.facebook.com/plugins/like.php?href=%1$s&layout=button_count&show_faces=false&width=90& action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px;"></iframe>
<!-- Begin Twitter Button -->
<script src="http://platform.twitter.com/widgets.js"; type="text/javascript"></script>
<a href="http://twitter.com/share"; class="twitter-share-button"
data-url="%1$s"
data-via="JAlLBREAKS"
data-text="%2$s"
data-count="horizontal">Tweet</a>
<!-- End Twitter Button -->
<g:plusone size="medium" href="%1$s"></g:plusone>
</div>', urlencode(get_permalink($post->ID)), the_title() );
return $link . $buttons;
}
And some css:
/*Social Buttons Alignment at HomePage*/
.buttons-home {float:right;}
#9
Posted 11 February 2012 - 10:06 AM
#10
Posted 11 February 2012 - 03:17 PM
<g:plusone size="medium" href="%1$s"></g:plusone>
#11
Posted 11 February 2012 - 05:58 PM
#12
Posted 11 February 2012 - 06:11 PM
#13
Posted 12 February 2012 - 05:47 AM
#14
Posted 12 February 2012 - 02:45 PM
#15
Posted 12 February 2012 - 03:33 PM
add_filter( 'pagelines_excerpt', 'after_post_title_social_front' );
add_action( 'wp_head', create_function('','echo "<script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script>";'));
function after_post_title_social_front ( $excerpt ) {
if ( !is_home() )
return;
$buttons = sprintf( '
<div class="buttons-home">
<iframe src="http://www.facebook.com/plugins/like.php?href=%1$s&layout=button_count&show_faces=false&width=90& action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px;"></iframe>
<!-- Begin Twitter Button -->
<script src="http://platform.twitter.com/widgets.js"; type="text/javascript"></script>
<a href="http://twitter.com/share"; class="twitter-share-button"
data-url="%1$s"
data-via="JAlLBREAKS"
data-text="%2$s"
data-count="horizontal">Tweet</a>
<!-- End Twitter Button -->
<g:plusone size="medium" href="%1$s"></g:plusone>
</div>', get_permalink(), get_the_title() );
return $excerpt . $buttons;
}
#16
Posted 12 February 2012 - 04:25 PM
#17
Posted 12 February 2012 - 04:47 PM
</div>', get_permalink(), get_the_title() );
As for the position, add some top padding to the div.
#18
Posted 12 February 2012 - 05:00 PM
#19
Posted 13 February 2012 - 04:49 AM
#20
Posted 13 February 2012 - 02:13 PM











