Jump to content

Sp0cK

New Members
  • Posts

    5
  • Joined

  • Last visited

Sp0cK's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is probably the lamest question you will see today, but for me the hardest to answer: sprintf( __( '%1$s起', 'woocommerce' ) I would like to style the character 起 with a span sort of like this: '%1$s'<span style='font-size: 10px;'起'</span>, 'woocommerce' ) I'm pretty sure I've got my quotes all wrong in this example. How do I do this the correct way if possible at all? It's on a live site so i can't play around with it too much... Thanks! The full line is: $saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s起', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
  2. If I use get_permalink(2343) it returns the correct post. So that works - meaning the $post_id is called from outside the loop. https://tommcfarlin.com/get-permalink-outside-loop/ I read several documentations that something like: function my_function() { global $post; get_permalink($post->ID); } will make it so it can be called outside the loop. So <script type="text/javascript" charset="utf-8" >var bShareOpt = {url: "<?php echo my_function(); ?>"};</script> should work right? But it doesn't
  3. It's from the documentation of bshare.cn which has all the share buttons for China. So I found out the permalink var bShareOpt = {url: "<?php the_permalink(); ?>"} and the_ID() actually do work. Problem is it shows the link/ID of the last article of that block instead the one I clicked on. See screenshot. Cheers!
  4. I looked a bit more in the documentation of those sharing icons. I'm pretty sure that if I can add this line of code there it will work <script type="text/javascript" charset="utf-8" >var bShareOpt = {url: "<?php the_permalink(); ?>"};</script> So normally it's set to url: ""; which directs to the page it's in. If I can add a piece of PHP code in javascript it will work, but I guess that's not allowed? I tried to look up how to retrieve $post_id in wordpress by using javascript although I didn't come very far... Ideas?
  5. Hi, I've added social sharing icons to every article on the homepage. Now they just share the page itself - the idea is to share that (wordpress) post/article. I've succeeded to do so with facebook likes on the English version with adding <div class="fb-like" data-href="<?php the_permalink(); ?>" Now I want to do the same with these 3 share icons: <div class="social-content"><?php if (ICL_LANGUAGE_CODE=='zh-hans'): ?><div class="bshare-custom"><div class="bsPromo bsPromo2"></div><a title="分享到微信" class="bshare-weixin" href="javascript:void(0);"></a><a title="分享到新浪微博" class="bshare-sinaminiblog" href="javascript:void(0);"></a><a title="分享到QQ空间" class="bshare-qzone"></a><a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a><span class="BSHARE_COUNT bshare-share-count" style="float: none;">19.5K</span></div><?php endif; ?></div> Can this be done by adding PHP? I'm not sure where I would have to add this... Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.