levlaz

Posts tagged: social

Follow Me on Twitter CTA on Ghost and Wordpress

2017-04-10 16:47:46 ][ Tags: social

The other day I read a post on Hacker News about premature optimization in web application development. This was an excellent post in its own right, but one thing that jumped out at me was the call to action from the author to follow him on Twitter at the end of his post. I liked that it was subtle, simple, and effective  (I followed him on Twitter). Naturally, I stole this idea for my own blogs. This method uses the Follow Button provided by Twitter. In this post, I will show you how to add your own "Follow Me on Twitter" Call to Action on  your own Wordpress or Ghost blog.

Wordpress

I used the Bottom of Every Post Wordpress Plugin because I found that hacking the main wordpress loop caused my CTA to show up at the very bottom of a page rather than at the end of the post content. In addition, I made a small change to this plugin to make sure that it only appears on single posts rather than on the home page. Edit bottom-of-every-post/bottom_of_every_post.php from the Wordpress Plugins Editor and update the method to be:

if( is_single() && file_exists( $fileName )){

 /* open the text file and read its contents */

 $theFile = fopen( $fileName, "r");
 $msg = fread( $theFile, filesize( $fileName ));
 fclose( $theFile );

 /* detect the old message in code to try and eradicate my name and #
 showing up on strange websites that are run by lazy people */

 if( $msg == "<p>Call for an estimate 724-498-1551<br><a href=\"mailto:corey.salzano@gmail.com\">corey.salzano@gmail.com</a></p>" ){
 $msg = "<p>Thank you for installing the Bottom of every post WordPress plugin. To find out how to change or remove this message, read <a href=\"http://wordpress.org/extend/plugins/bottom-of-every-post/installation/\">the instructions</a>.</p>";
 }

 /* append the text file contents to the end of `the_content` */
 return $content . stripslashes( $msg );
 } else{

 /* if `the_content` belongs to a page or our file is missing
 the result of this filter is no change to `the_content` */

 return $content;
 }

The key here is

is_single()

Next, edit bottom-of-every-post/bottom_of_every_post.txt and add your call to action. Mine looks like this.

<p>
 If you made it this far, you should probably follow me on twitter. :) 
 <a class="twitter-follow-button" href="https://twitter.com/levlaz"> Follow @levlaz</a>
</p>

<script>window.twttr = (function(d, s, id) {
 var js, fjs = d.getElementsByTagName(s)[0],
 t = window.twttr || {};
 if (d.getElementById(id)) return t;
 js = d.createElement(s);
 js.id = id;
 js.src = "https://platform.twitter.com/widgets.js";
 fjs.parentNode.insertBefore(js, fjs);

 t._e = [];
 t.ready = function(f) {
 t._e.push(f);
 };

 return t;
}(document, "script", "twitter-wjs"));</script>

You only need to replace your twitter username in the above example and it should work as is. The end result is shown below: Screen Shot
2017-04-10 at 4.44.14
PM.png{.alignnone .size-full .wp-image-650 width="527" height="89"}

Ghost

I used ghosts code-injection tool to get this to work for every page. I added the following two scripts to the Blog Footer.

<script> 
 article = document.getElementsByClassName('post-content');
 child = document.createElement('p');
 cta = '<p class="follow"> If you read this far, thank you! Follow me on Twitter to stay up to date on what the fuss is all about.<br />';
 link = '<a class="twitter-follow-button" href="https://twitter.com/tralevnet"> Follow @tralevnet</a></p>'
 child.innerHTML = cta + link;
 article[0].appendChild(child);
</script>

<script>
 window.twttr = (function(d, s, id) {
 var js, fjs = d.getElementsByTagName(s)[0],
 t = window.twttr || {};
 if (d.getElementById(id)) return t;
 js = d.createElement(s);
 js.id = id;
 js.src = "https://platform.twitter.com/widgets.js";
 fjs.parentNode.insertBefore(js, fjs);

 t._e = [];
 t.ready = function(f) {
 t._e.push(f);
 };

 return t;
}(document, "script", "twitter-wjs"));
</script>

In the example above you need to change your call to action as well as your twitter username for it to work. I also added a custom style to the Blog Header

<style> 
.follow {
 line-height: 1.5;
 width: 50%;
 padding: 15px;
 border: dashed 1px lightgrey;
 font-size: smaller;
 color: #555;
 font-family: sans-serif;
 font-weight: bold;
 }

 .twitter-follow-button {
 margin-top: 10px;
 }
</style>

The end result looks like this: Screen Shot 2017-04-10 at 4.46.57
PM.png{.alignnone .size-full .wp-image-659 width="388" height="186"} That's pretty much it. You can go wild with the style to your hearts content. I like this simple CTA and I am excited to see how effective it is on my own blogs.

Quit Social Media. Your Career May Depend on It.

2016-11-20 17:20:40 ][ Tags: social

I enjoyed reading this article, it brings up some very valid points. I have recently been reevaluating my own use of Social Media, this certainly gives me something else to think about.

Professional success is hard, but it’s not complicated. The foundation to achievement and fulfillment, almost without exception, requires that you hone a useful craft and then apply it to things that people care about.

Source: Quit Social Media. Your Career May Depend on It. - NYTimes.com

Twitter Has Become Unbearable

2016-05-10 18:56:37 ][ Tags: social

I feel that lately Twitter has just become unbearable. I am going to sound like a curmudgeon but I miss the old twitter. Remember when you had a timeline full of peoples ideas? Remember when more than 3 tweet fit on a page? Remember when you used to be able to be able to see tweet from people that you actually follow? Those were the good old days, when I log into Twitter these days I am bombarded with bullshit.

But Lev, why not just stop using Twitter instead of complaining about it on your blog?

That is an excellent question.

Believe it or not, I actually like Twitter. The people I chose to follow consistently provide me with awesome things to read about, explore and discuss. The problem is that finding the things that I care about has become increasingly difficult in this sea of bullshit.

I thought all hope was lost until I found Twipster. It seems like it was made specifically for curmudgeon's like me. I absolutely love this extension, it just cuts out all of the bullshit and makes Twitter usable for me again. I made a few additions to also remove images and videos and personally I think this is a much better twitter experience.

Share This on Facebook

2016-05-10 18:55:10 ][ Tags: social

I read an article on HN today about how facebook has destroyed the open web. I have not used Facebook for many years, so I don't actually know what is is like anymore. While this very well may be, I could not help but be baffled by the irony of the way that International Business Times works. Not only does it start to auto-play some crappy video ad as soon as you land on the page. Once you get to the bottom of the article it shows you this:

[caption id="attachment_279" align="aligncenter" width="499"]Ad Ridden IBT Website Ad Ridden IBT Website[/caption]

Facebook may have destroyed the open web. But its sites like IBT that have destroyed the rest of it.