I am using ShareThis to integrate social websites with my site. I want to be able to set the title of the share to whatever I like. Right now I am using:
<span class='st_facebook_vcount' displayText='Facebook'></span>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js">
</script> <script type="text/javascript">
stLight.options({
publisher:'12345',
});
</script>
<span class='st_twitter_vcount' displayText='Tweet'></span>
I want part of the title to be set dynamically via php variable (name of profile owner).How can this be ddone?
Thanks,
See http://support.sharethis.com/customer/portal/articles/475079-share-properties-and-sharing-custom-information add st_title="Your title" to the span:
<span class='st_facebook_vcount' displayText='Facebook' st_title="Your title></span>
Related
How to implement tages mechanism like stackoverflow tag?
Using PHP, MySQL and JS.JQUERY
Wendy, there is a Jquery UI plugin (tag it) on github,
Provides same functionalities like SO autocomplete tags
here is the link to download : https://github.com/aehlke/tag-it
and here is home page link : http://aehlke.github.io/tag-it/
and small demo code you can use as below
<script type="text/javascript">
$(document).ready(function() {
$("#myTags").tagit();
});
</script>
<ul id="myTags">
<!-- Existing list items will be pre-added to the tags -->
<li>javascript</li>
<li>python</li>
<li>haskell</li>
</ul>
see the screenshot below
let me know if any help needed.
i would like to know how to use a custom URL with ShareThis social share plugin. for a example i have a post summery on my index.php page taht is linking to my-post.php so what i want to do is to make users share my-post.php from my index page.
here is the code from sharethis.com
Buttons:
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
<span class='st_pinterest_hcount' displayText='Pinterest'></span>
JS:
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});</script>
You can append a st_url property to each of your span tags which will control the URL that is shared.
<span class='st_facebook_hcount' st_url='http://my.custom.com/url' displayText='Facebook'></span>
Source: https://support.sharethis.com/hc/en-us/articles/218441477-How-to-Customize-which-URL-Text-and-IMG-to-Share
Just use st_url attribute like this:
<span class="st_sharethis" st_url="http://www.yoursite.com/innerpage.php" st_title="inner page title" displayText="ShareThis"></span>
You can just add an extra atrribute like
<div class="sharethis-inline-share-buttons" data-url="<!--YOUR_URL_GOES_HERE-->"></div>
I am trying to hide a comment form on my wordpress blog (although the page isn't the wordpress blog, I just get the posts).
If I have comments then the hide/show will work for the form and for the comments. If I have no comments the function doesn't work and i'm not sure why.
If anybody can help I can upload the php files that show the posts (blog.php) and the comments page (comments.php) that is generated within the wordpress theme.
EDIT: PHP code removed as not relevant to error. Relevant HTML code as follows:
...
<body class="home blog logged-in custom-background">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#content img").addClass("imageSeven");
});
</script>
...
<a id="replytitle" href="javascript:togglecommentform('replyform17');">Show Comment Form</a>
<div id="replyform17" style="display:block;">
...
</div>
...
<a id="replytitle" href="javascript:togglecommentform('replyform6');">Show Comment Form</a>
<div id="replyform6" style="display:block;">
...
</div>
...
You have a problem, in that the output (view source) has a reference to jQuery right at the top:
<body class="home blog logged-in custom-background">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#content img").addClass("imageSeven");
});
</script>
Some points on this:
Because you don't include a reference to jQuery anywhere - this will cause an error, meaning that even if the rest of you JavaScript is valid, it will fail to run.
You don't need jQuery(document).ready... if you move all your JavaScript to the bottom of the page (just before the </body> end tag.)
Your main problem seems to be a confused code structure. Based on the messy code you have (no offense), I would recommend using a library like jQuery:
Step 1: Remove all the JavaScript you have in that page.
By the looks of things, that just means the <script> block thats right beneath your <body> tag.
Step 2: Replace these <a> start tags:
<a id="replytitle" href="javascript:togglecommentform('replyform17');">
<a id="replytitle" href="javascript:togglecommentform('replyform6');">
With these:
<a id="replytitle17" href="#">
<a id="replytitle6" href="#">
Step 3: Just before the </body> tag, include the following:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
var images = $('#content img');
if (images.length > 0) { images.addClass("imageSeven"); }
$('#replytitle17').click(function() { $('#replyform17').toggle(); });
$('#replytitle6').click(function() { $('#replyform6').toggle(); });
</script>
This should achieve everything your page has, in jQuery.
I'm attempting to use embedded code from a page within my server, the problem is that when I also try to add URL links to my Facebook below it they're not working?
I'm using this code which was successfully implemented. I'm not sure if the links I'm adding is hidden behind the image, but if it is I'm not sure how to get the link to show on top of the background image.
<body>
<img src="images/background.jpg" alt="" id="background" />
Facebook Link
<div rel="00000000" class="lrdiscoverwidget" data-logo="on" data-background="off" data-share-url="www.domain.com" data-css="">
<script type="text/javascript" src="http://launchrock-ignition.s3.amazonaws.com/ignition.1.1.js"></script>
</div>
<script type="text/javascript">
$(window).load(function() {
$("#background").fullBg();
});
</script>
</body>
Thank you!
I have the following code:
<a href="http://twitter.com/share" class="twitter-share-button" data-text="Text text text" data-count="none">
Tweet
</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
It adds to the text shortened url to the page on which the button was clicked. How can I disable auto adding url? Thanks.
The point of the twitter share button is to share the site you are on.
You can override it with the data-url attribute.
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
You can at a custom url with the data-url attribute, than it ignores the url on the page he currently is:
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>