Hendrik Spree
asked 9 years ago

I use the Jason theme and I like the style a lot. But I recognize the sharing options are somehow messed up. For example, when I want to share a blogpost to Facebook, the pop-up looks like this.

![enter image description here](http://i.imgur.com/ZWiIOND.png "enter image title here")

Seems to have no content. And when I hit "Share Link", nothing happens. Neither closes the pop-up, nor is something published on Facebook.

When I click the little Twitter bird, two pop-ups appear one above the other. (I dragged them next to each other in this screenshot.)

![enter image description here](http://i.imgur.com/3c7EKz4.png "enter image title here")

The tweet will be published, but the URL included – although working – looks broken. (Twitter card due to my manually inserted code, if that’s of interest.)

<blockquote class="twitter-tweet" lang="en">

Aus den Memoiren des SeΓ±or Havvelpaff (62) http://<a href="http://t.co/cTMRl8638Q”>http://t.co/cTMRl8638Q”>http://t.co/cTMRl8638Q

— -drik S. (@drikkes) <a href="March”>https://twitter.com/drikkes/status/572674992091086848″>March 3, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8">

Coming to Google+, the only service which seems to work properly. Unfortunately I didn’t like Google, so may I ask where to get rid of that service? But I have a minor problem with all three sharing buttons. I like the mouseover effect showing the colour of each service. However, after using one of the sharing buttons, they all turn to Twitter blue. See.

![enter image description here](http://i.imgur.com/IFHJ4ZA.png "enter image title here")

Is that a problem only on my site http://drikkes.com/ or is this a general theme issue? And how can I solve it? Thanks in advance for help!

1 Answers
Allen
answered 9 years ago

@hendrik : hi there , you can try this

open file "single.php" in Jason theme , go to line 38 u can see those code :

<ul class="social-links list-inline">
     <li class="facebook"><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo esc_url( $url ); ?>&amp;t=<?php echo esc_html( $title ); ?>" title="<?php _e( 'Share this post on Facebook', 'dw_jason' ) ?>" ><i class="fa fa-facebook"></i></a></li>
     <li class="twitter"><a href="https://twitter.com/intent/tweet?url=<?php echo esc_url( $url ); ?>&amp;text=<?php echo esc_html( $title ); ?>" title="<?php _e( 'Share this post on Twitter', 'dw_jason' ) ?>"><i class="fa fa-twitter"></i></a></li>
     <li class="google-plus"><a href="https://plus.google.com/share?url=<?php echo esc_url( $url ); ?>" title="<?php _e( 'Share this post on Google Plus', 'dw_jason' ) ?>"><i class="fa fa-google-plus"></i></a></li>
</ul>

you can try replace all that echo esc_url( $url ); to echo esc_attr( $url );.

hope that help πŸ™‚

nobita
replied 9 years ago

if still not work , then try to remove that esc_url() or esc_attr(), just leave the $url there πŸ™‚

drikkes
replied 9 years ago

Sorry to ask again, I’m quite a coding idiot. I replaced all three esc_url( $url ); with esc_attr( $url ); – one for Facebook, one for Twitter, one for Google+. I assume you either forgot to "echo" in the first code or doubled it in the second? (I tried both, with and without "echo") Result is this:
Facebook-Sharing now works. But Twitter still pops up twice. And all three logos are twitter-blue after using the share function.

try to remove that esc_url() or esc_attr(), just leave the $url there

Sorry, I didn’t get this. When I do exactly as you suggest, only the URLs show up in the sharing pop-ups, no preview content. I guess I do something wrong?

nobita
replied 9 years ago

@hendrik : well i found out the main problem with the sharing function is that when use esc_url( $url ) , the link will be print out like this : " http:\http:\ " , so it’ll point to the wrong link ( no such link name : http:\http:\ … ) when use facebook , twitter sharer. So , the esc_attr( $url ); will work with facebook but i’m not sure a bout twitter , then you can try only use $url , don’t need those escape function , that’s my idea πŸ™‚

and about that color after sharing , the logos have no color change , you can try deactivate some plugins to test and check what plugin that effect the color and twitter share πŸ™‚
Glad πŸ™‚

drikkes
replied 9 years ago

I’m not able to make this work properly. So I threw out the whole theme’s sharing code and embedded WP’s own sharing feature.

nobita
replied 9 years ago

Well i think you could remove the WP’s own sharing feature and try remove the esc_url() as i said , that’s the main point of this problem i think :), it could be some conflicts within this theme sharing and WP’s own sharing feature that make css code go wrong because as i tested , the icon does not change color after you share πŸ™‚ it’s just change when you hover πŸ™‚

Powered by DW Question & Answer Pro