Skip to content

Commit

Permalink
Moved social icons output outside the the_content filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dziudek committed Aug 7, 2015
1 parent ddb17c2 commit 6bc09d2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion content-archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$post_helper_css_classes .= get_theme_mod('portfolio_frontpage_animation_speed', '500') !== '' ? $animation_speed : '';
$post_helper_css_classes .= (get_theme_mod('portfolio_show_excerpts', '1') == '0' && is_sticky()) ? ' sticky' : '';

$post_preview_animation = get_theme_mod('portfolio_post_preview_animation', 'animation-slide-up');
$post_preview_animation = get_theme_mod('portfolio_post_preview_animation', 'slide-up');

?>

Expand Down Expand Up @@ -91,6 +91,8 @@
<?php else : ?>
<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>

<?php
Expand Down
2 changes: 2 additions & 0 deletions content-gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<?php else : ?>
<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
</div><!-- .entry-content -->
<?php endif; ?>
Expand Down
2 changes: 2 additions & 0 deletions content-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<?php else : ?>
<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
Expand Down
2 changes: 2 additions & 0 deletions content-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
</div><!-- .entry-content -->
</div>
Expand Down
2 changes: 2 additions & 0 deletions content-quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
</div><!-- .entry-content -->
</div>
Expand Down
2 changes: 2 additions & 0 deletions content-video.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
<div class="entry-content">
<?php if($video_code != '') : ?>
<?php echo str_replace($video_code, '', apply_filters('the_content', get_the_content( __( 'Read more', 'portfolio' ) ))); ?>
<?php echo portfolio_social_button(); ?>
<?php else : ?>
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>
<?php endif; ?>

<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
Expand Down
3 changes: 3 additions & 0 deletions content.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
<?php else : ?>
<div class="entry-content">
<?php the_content(__('Read more', 'portfolio')); ?>
<?php echo portfolio_social_button(); ?>

<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'portfolio') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>

<?php
if(get_theme_mod('portfolio_post_show_tags', '1') == '1') {
$tag_list = get_the_tag_list('<ul class="tags-links"><li>',', </li><li>','</li></ul>');
Expand Down
7 changes: 4 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,15 @@ function portfolio_the_attached_image() {
* @param string $content Post content.
* @return string Post content with HTML output.
*/
function portfolio_social_button($content) {
function portfolio_social_button() {
global $post;
// get posts titles and permalinks
$permalink = get_permalink($post->ID);
$title = get_the_title();
$content = '';
// add share button only on posts pages
if(!is_feed() && !is_home() && !is_page() && get_theme_mod('portfolio_post_show_social', '1') == '1') {
$content = $content . '<div class="gk-social-buttons">
$content = '<div class="gk-social-buttons">
<span class="gk-social-label">'.__( 'Share:', 'portfolio' ).'</span>
<a class="gk-social-twitter" href="http://twitter.com/share?text='.urlencode($title).'&amp;url='.urlencode($permalink).'"
onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;">
Expand All @@ -417,7 +418,7 @@ function portfolio_social_button($content) {
}
}

add_filter('the_content', 'portfolio_social_button');
//add_filter('the_content', 'portfolio_social_button');


if(get_theme_mod('portfolio_special_img_size', '0') == '1') {
Expand Down

0 comments on commit 6bc09d2

Please sign in to comment.