Thesis Theme makes life a lot simpler, if you are trying to customize your blog. In this post, I will show you how to display your latest tweets at the top of your content column. You can either choose to display this only on the Home page or on all pages.
What we will Create?
This is what we are trying to create in this tutorial – the latest twitter update on the top of your content column. There is also a link to your Twitter profile home page.
How do we get this?
As with any other customization in Thesis Theme, this requires changes in the following files found under the
- custom_functions.php
- custom.css
Changes in custom.css
Copy the following code into your custom.css file towards the bottom. I have suitably demarcated the code with a comment, so that you can easily identify it later.
/* Twitter widget Before content */ #twitter_div { background:transparent url(images/twitter_verysmall.gif) no-repeat scroll 0 10px; padding:10px 0 10px 48px; position:relative; } #twitter_div li { font-family:georgia,serif; font-size:1em; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:normal; line-height:normal; list-style-image:none; list-style-position:outside; list-style-type:none; } #twitter_div li span { display:block; font-size:1.1em; font-style:italic; } #twitter_div ul { margin:0 0 8px 12px; } #twitter_div li span a a:visited { color:#2A69A3; text-decoration:none; } #twitter_link { color:#2A69A3; text-decoration:none; font-size:1em; font-style:italic; float:right; margin-right:25px; } /* Twitter widget Before content */
I have used a very small Twitter icon that displays on the left corner. You can download the icon from here (right click and ‘Save as’).
Copy this file into your
Changes in custom_functions.php
Now copy the following code into your custom_functions.php file. This code uses the ‘thesis_hook_before_content’ of Thesis. So if you are already using this Hook in your Thesis Customization, just add only the HTML portion of this code towards the end (if you have any problems, feel free to contact me).
/* Latest Tweets above Content column */ function my_thesis_before_content() { if (is_home()) { ?>In the above code, there are a couple of points where it is mentioned as **yourtwitter**. Replace them with your Twitter username.
Current Code as is, would display the Twitter updates only on your home page. If you want this to be displayed on all other pages and posts, just remove the following
- if (is_home()) from the top
- } from the bottom
Tip: For the sake of this tutorial, I have used the thesis_hook_before_content hook. But you can easily replace with other hooks like thesis_hook_before_post_box, thesis_hook_before_post, thesis_hook_after_post, thesis_hook_after_post_box, etc., depending on where you need the Twitter updates to appear. Love the power of Thesis!
Conclusion
And, that’s it. Now just reload your page and see your latest tweet right there at the top. Contact me @tublogger or in case you face any issues with setting this up on your Thesis Blog. I would love to help!