fix share options

This commit is contained in:
Leo Germani 2018-08-10 17:24:04 -03:00
parent d405ae0108
commit 20b701268e
2 changed files with 6 additions and 5 deletions

View File

@ -128,7 +128,7 @@ function tainacan_customize_register( $wp_customize ) {
) ); ) );
$wp_customize->add_control( 'twitter_user', array( $wp_customize->add_control( 'twitter_user', array(
'label' => __( 'Twitter User', 'tainacan-theme' ), 'label' => __( 'Twitter User to be cited in tweets (via @user)', 'tainacan-theme' ),
'section' => 'social_share', 'section' => 'social_share',
) ); ) );

View File

@ -102,17 +102,18 @@
<div class="card-body bg-white border-0 pl-0 pt-0 pb-1"> <div class="card-body bg-white border-0 pl-0 pt-0 pb-1">
<h3><?php _e('Share', 'tainacan-theme'); ?></h3> <h3><?php _e('Share', 'tainacan-theme'); ?></h3>
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<?php if ( true == get_theme_mod( 'facebook_share', false ) ) : ?> <?php if ( true == get_theme_mod( 'facebook_share', true ) ) : ?>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="item-card-link--sharing" target="_blank"> <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="item-card-link--sharing" target="_blank">
<img src="<?=get_template_directory_uri().'/assets/images/facebook-circle.png'; ?>" alt=""> <img src="<?=get_template_directory_uri().'/assets/images/facebook-circle.png'; ?>" alt="">
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php if ( true == get_theme_mod( 'twitter_share', false ) && get_option( 'twitter_user') ) : ?> <?php if ( true == get_theme_mod( 'twitter_share', true ) ) : ?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?>&amp;via=<?php echo get_option( 'twitter_user', '' ) ?>" target="_blank" class="item-card-link--sharing"> <?php $via = !empty(get_option( 'twitter_user')) ? '&amp;via=' . get_option( 'twitter_user') : ''; ?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="item-card-link--sharing">
<img src="<?=get_template_directory_uri().'/assets/images/twitter-circle.png'; ?>" alt=""> <img src="<?=get_template_directory_uri().'/assets/images/twitter-circle.png'; ?>" alt="">
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php if ( true == get_theme_mod( 'google_share', false ) ) : ?> <?php if ( true == get_theme_mod( 'google_share', true ) ) : ?>
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing"> <a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" target="_blank" class="item-card-link--sharing">
<img src="<?=get_template_directory_uri().'/assets/images/google-plus-circle.png'; ?>" alt=""> <img src="<?=get_template_directory_uri().'/assets/images/google-plus-circle.png'; ?>" alt="">
</a> </a>