Swapping the sharing page twitter logo by text - wordpress

I would like to add a share link from my wordpress website to tweeter.
I found how to do it but, I would like to remove the twitter logo and add a simple text link.
So I removed the twitter class "twitter-share-button" but I can't retrieve informations into the twitter textbox...
Here is my code:
<a href="https://twitter.com/share" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-hashtags="hashtag" >THIS_TEXT_THAT_I_WANT_TO_DISPLAY and add all data content to the twitter text area</a>
<script>
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}}
(document,"script","twitter-wjs");
</script>
Thanks

You can build your own Twitter share URL. You don't need to include any javascript or the Twitter SDK, it's just an HTML link. More info on building your own at https://dev.twitter.com/docs/tweet-button, just scroll all the way to the bottom of the page. Try something like this for yourmarkup:
Tweet this
There are a lot of things you can pass into the url, so you can tweak this to get the result you're looking for.

Here is the result code:
Tweet this

Related

how to add brand name with image at facebook page share content

Sometimes we see some page post on my timeline, where website shareing link conatin a image, below part of image attach with a page brand name (i have atatch a image example below.). if you click on link you will go to the website page and you will not see the brand name with image. I think somehow this brand name added later by coding or other system. I am confirm, content uploader does not attach this brand name with image, it happen automaticaly.
there anyone please tell me the system nmae and how to do it? at word press how can do that? have any plugin or code? thanks in advance.
You have to add the meta property inside the header area of ​​your site. Please check below article to know more.
For Facebook
For Twitter
You can add meta properties like this.
add_action('wp_head','add_meta_tags');
function add_meta_tags() {
global $post;
echo '<meta property="og:title" content="'.$post->post_title.'" />';
// So on....
}

URL Field not appearing correctly in anchor

I have run into a very interesting problem. I am working on a site for a client of mine and have run into this issue using Advanced Custom Fields no wordpress. I have added a new custom field to the site for their rewards program spot, and I am having trouble getting the url field to work corretly. I have the code added to the template php file that it needs to be in and it looks like this at the moment.
<div class="row">
<?php $ficvalue = get_field('free-icecream-url');
if ($ficvalue) {
$ficurl = esc_url($ficvalue);
}?>
<h3 class="heading" style="text-align: center;"><?php the_field('free-icecream-header'); ?></h3>
<a href"<?php echo $ficurl; ?>" class="btn btn-primary" style="max-width: 15em;"><?php the_field('free-icecream-btn'); ?></a>
</div>
When I put the url into the custom url field on the backend in the page editor, it doesn't appear in the anchor correctly. if I add this line to the page, it shows the url correctly on the page itself:
<?php echo get_field('free-icecream-url'); ?>
This will show the url as it is inserted into the custom field, however adding it into the anchor's href like this provides a different result.
<?php the_field('free-icecream-btn'); ?>
<!-- results as the following in chromes inspect -->
<!-- https: www.rococoicecream.com rococo-rewards
Instead of https://www.rococoicecream.com/rococorewards -->
I have tried to use esc_url() and esc_html() to no avail. and when using the_field() it yields the same results. What am I doing wrong?
The answer to my question here was answered shortly after posting it. I updated the original question but I will also place it here. I found the problem I was having was that I missed a = after the href in the anchor for my button. After finding that out, it works like a charm.

Unable to configure Twitter feed in Drupal site

I have a website in Drupal and I wants same look of twitter widget as in https://www.stanford.edu/ .
There is a module also available in Drupal for Twitter i.e "Drupal feed".
https://www.stanford.edu/ site is mentioned in this module also.
So please help me out so that i can get same look..
Thanks in Advance..
Note : The code i am using is given below.
<a class="twitter-timeline" href="https://twitter.com/tweettestwidget" data-widget-id="603417854055034880" data-chrome="noheader nofooter noborders transparent" data-tweet-limit="1" data-conversation="none">Tweets by #tweettestwidget</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I used the Twitter module to create a similar twitter feed.
https://www.drupal.org/project/twitter
You can see the feed I created here http://gekkos.com
You can then display the Twitter feed using a View. Then use Views templates to style the output.
E.g. My Views template file was views-view-fields-tweets--block.tpl.php
<div class="tweet">
<p><a target="_blank" href="https://twitter.com/<?php print $fields['screen_name']->content;?>"><?php print $fields['screen_name']->content;?></a> <?php print $fields['text']->content;?> - <em><?php print $fields['created_time']->content;?></em></p>
Then just style the output using CSS.

Twitter share button doesn't forward custom text

I'm working on a website with twitter share option for each specific product.
I followed twitter API instructions for tweet-sharing, and everything works fine except custom display of text. For example I want user to tweet like this:
"What do you think? Should I buy this? http://url.etc #mywebsite"
but all I get when user tweets is the link:
http://url.etc
This is the code:
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<a target="_blank" href="https://twitter.com/share" data-url="http://bit.ly/twitter-api-announce" data-via="testtest" data-text="What do you think? Should I buy this? " data-count="none" data-counturl="http://groups.google.com/group/twitter-api-announce" >TWITTER</a>
The problems seems to be with data-text option.
Any experience on this? Ideas?
Thanks
On Wordpress I just used Tweet
Works like a charm!
simply use a link like :
tweet
Just change what is between [] (and remove them)
note that everything have to be RFC (with weird chars such as 'space' replaced by %20 etc.)
twitter propose a nice page to make the buttons
https://about.twitter.com/resources/buttons#tweet
But my solution avoid the javascript to force the design of the buton
You can use this:
<a href='https://twitter.com/share?url=google.com&text=Signup>Tweet</a <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');</script>
Confirm that you have included the correct twitter scripts . Better still, generate your tweet button code from the twitter developer interface here ..
https://about.twitter.com/resources/buttons
If you would like to modify the tweetbutton content on the fly ...e.g after page load, you will have to creat and insert your tweet button into the html DOM dynamically .
Some guidance on that can be found here .
http://denvycom.com/blog/twitter-button-with-dynamic-custom-data-text-message/
Hopefully this is helpful.
You have to encode your text before inserting it in the link. The correct procedure is:
Encode the text with an online tool like this one
Put the result inside an HTML link (as suggested by #FenixAoras): Share on Twitter
If you generate your HTML with php, you can use the urlencode function directly in your script:
echo "Share on Twitter";
If you are using WordPress, the best way is creating a shortcode, beacuse with it you can use also the native functions of WordPress:
function tweet_this($atts, $content = null)
{
extract(shortcode_atts(array(
"text" => ''
), $atts));
return "<a href='https://twitter.com/intent/tweet?text=".urlencode( $text." - ".get_the_title()." - ".get_permalink() )."'>Share on Twitter</a>";
}
add_shortcode( 'tweet_this', 'tweet_this' );
(Note: the code above is just a lead, you can expand it and you have to test)
Usage:
[tweet_this text="my custom text with #hashtag and #Mention"]

Wordpress Post Content Get Url

quick question I know in wordpress you can get post_content,etc
but let say I input into the content just a url such http://www.google.com and then
i want to get that url inside a div so it would look like something along those lines. do I have to do anything special with the url or can i simply just do get post_content.
My end goal is to incorporate the url in a colorbox so it will just grab the url from the post content and use it with the colorbox??
hope that made some sense...
thank you
-david
You do not have to do anything special in terms of preparing your post on the admin side, but to incorporate this into the Colorbox code, make sure you are putting the 'post_content' in the right place. In the 'Outside HTML (IFrame)' example from the Colorbox site:
http://colorpowered.com/colorbox/core/example1/index.html
You could implement your code as follows:
<?php your wordpress query here?>
<a class="colorboxClass" href="<?php the_content(); ?>">Your Colorbox Link Text</a>
<?php end your query?>

Resources