I'm trying to implement a 'Tweet' button on my wordpress site and am having an issue where the URL doesn't show in the tweet.
It shows the hashtag and the account but not the URL.
My code is as follows:
Tweet
If i don't use the data-url then it just inserts the base domain name and not the full URL.
Any ideas?
Have you tried the code on the twitter page instead? Have a look at the twitter API here.
You are missing javascript code.
You probably got your code from HERE
For sharing a link, the javascript code is
<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>
Just add this code after your anchor tag.
I had the following code:
Tweet
<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>
But that didn't work, so I tried a simplified version:
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
And this one worked just fine. Just keep in mind that the username has to be somehow integrated in your theme settings, if it's not, you can change:
<?php echo of_get_option( 'ac_twitter_username' ); ?>
For your twitter username.
I hope this works, It took me a while to find this more generic approach. I don't fully know what I'm doing, so if anyone sees an issue with this approach, please let me know. So far, it works great.
Thanks!
Related
I tried to create one canvas page on facebook
here is the config:
and for test I havent added any code in index php, i have just added:
index.php
<?php
echo "welcome to canvas";
?>
but on facebook page its not showing any data, please help to fix this
Thanks to Raptor, so bad mistakes here is that needs https url for canvas.
I am building a facebook like button , in the href tag i want to keep my own custom url stored in php variable. But the like button doesn't shows with it. Any solution
CODE
<?php echo '<fb:like href=" '.$urlToLink.' " width="450" layout="box_count" show_faces="false" send="false"></fb:like>'; ?>
$urlToLink has somethig like this-> "http://localhost/website/view.php?asdpfimi34mmksd"
Put the URL in the debugger and check it for Errors/Warnings: https://developers.facebook.com/tools/debug
Also, try the URL in the Plugin generator: https://developers.facebook.com/docs/reference/plugins/like/ - and see if it gets rendered correctly.
And i hope you´re not serious with "localhost", because that will not work, of course. Facebook does not have access to your localhost, and the URL you provide has to be accessible in public, without any user login.
I'm trying to build a custom top toolbar which an iframe below it.
Something similar to this:
http://themes.goodlayers.com/?theme=greenearth
I plan one using it on a blog, so i will be making posts linking to other sites. My question is what do i need to make a custom url function that so i just add it in front of the other site's url so that it shows up in an iframe.
For example:
I want to link to google in an iframe with my top toolbar above.
Is there a script that allows me to use a url like this:
http://www.mywebsite.com/frame.php?http://www.google.com/
Thanks for your time!
Iframes are always bad. Don't do it.
That said, with PHP, you can do this:
<iframe src="<? echo $_SERVER['QUERY_STRING'] ?>" />
You can also do something like mywebsite.com?url=google.com, and use $_GET['url'] instead.
Eg url: http://mywebsite.com/index.php?iframe=http://www.google.ro
PHP:
<?php
if ($_GET['iframe']) {
echo"<iframe src='".$_GET['iframe']"' width='200px' height='150px'>";
} ?>
I hope this will help you!
I am trying to use mixpanel for analytic in my Wordpress blog (just for learning).
My blog is all php.
I got the code from mixpanel's website and put it in my header.php file.
<!-- start Mixpanel --><script type="text/javascript">(function(c,a){window.mixpanel=a;var b,d,h,e;b=c.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.0.min.js';d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d);a._i=[];a.init=function(b,c,f){function d(a,b){var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==
typeof f?g=a[f]=[]:f="mixpanel";g.people=g.people||[];h="disable track track_pageview track_links track_forms register register_once unregister identify name_tag set_config people.set people.increment".split(" ");for(e=0;e<h.length;e++)d(g,h[e]);a._i.push([b,c,f])};a.__SV=1.1})(document,window.mixpanel||[]);
mixpanel.init("MYKEY");</script><!-- end Mixpanel -->
Here, MYKEY is my actual key.
Now, I want to see page views for each of my blog posts.
I am putting following code in page.php, which gets called each time a post is viewed (afaik).
<script type="php">
mixpanel.track("Viewed Post")
</script>
But I am not getting any data back. Can someone please help me here?
I am using Mixpanel on my blog (along Google Analytics). Some suggestions
Make sure you've put the mixpanel code before the head closing statement </head>. In many themes you will find a lot of code below the </head> for example the <body class="<?php hybrid_body_class(); ?>"> in the case of hybrid based themes
I am not sure why you are using <script type="php"> the usual is <script type="text/javascript">
Hope this helps!
in all my wordpress website i want to delete this mixpanel, someone can tell me how i can do that?
MixPanel does not work well with Wordpress blog. I would use Google Analytics.
Hello I am trying to figure out how to make it so when someone clicks a link on my search results it will open in a new window and in the new window have an iframe that displays the url. I am not sure how to go about doing this. I have
$row['url']
that displays the url for each result to use.
To be more specific I am trying to do what filestube does. I like the feature a lot and would like to use something like it on my site. Here is an example url to show you want I mean http://www.filestube.com/5a4c10249bd9fce003e9/go.html
when the link is clicked on filestube it will open a page like this. I have seen lots of sites do this but filestube is what pops in my head right now. Can anyone provide me with a code example or try to explain how to do this? thanks.
You need to redirect to a URL inside of your application, example my_url.php and post to it in parameters the URL you want to show. Than in that script, load an iFrame with that URL.
Example of my_url.php?url=http://www.google.ca:
<div>You Header</div>
<iframe src="<?php $_GET['url']"></iframe>
<div>Your Footer</div>
The link should point to another PHP page. Something like this.
http://www.google.com
In your open-link.php, write your iframe code.
<iframe src="<?=$_GET['url']?>"></iframe>
Assuming you have PHP file named external.php
Make that PHP file accept a $_GET parameter.
Pass the URL as a param
Use that URL to point the iframe in that PHP file to whatever URL is passed