Category: Personal

  • HOW TO: Adsense Section Targeting In Thesis

    Adsense section targeting should be adopted by any publisher serious about earning bucks from the Google Adsense advertisements program on their Thesis site. Targeting basically means telling Adsense which sections of your content should be considered for displaying contextual ads. For example, on a site like Niponwave where I display the OS of the users leaving comments here and a lot of people use Windows, if I were running Adsense, the word ‘Windows’ would have been picked up and many of my visitors would see advertisements related to the Microsoft OS. Get the drift? But if you want to show only relevant and contextual ads to your visitors then adsense section targeting is what you should be after. In fact, this is a recommended practice. Without further ado, let me type out the following few lines of code that will let you have Adsense Section Targeting enabled on your Thesis site in a few seconds.

    // Adsense Section Targeting for posts
    function start_adsense(){
    echo "<!-- google_ad_section_start -->";
    }
    function end_adsense(){
    echo "<!-- google_ad_section_end -->";
    }
    add_action('thesis_hook_before_post','start_adsense');
    add_action('thesis_hook_after_post','end_adsense');

    Most people want to target only the posts – the post means the entire content of your post and just that, cutting out all the garbage info like Related Posts, Comments, Author Byline and so on – which is pretty cool. The above code fully achieves that.

    However, if your site has an active community and there are always engaging conversations then you will for sure get comments that add more value to the posts, in which case it certainly makes sense to target the comments as well. Enter Adsense Section Targeting for Thesis Comments. Of course I am targeting purely the comment text and not the commenter’s name, the datestamp and other such unnecessary info.

    // Adsense Section Targeting for comments
    function start_adsense(){
    echo "<!-- google_ad_section_start -->";
    }
    function end_adsense(){
    echo "<!-- google_ad_section_end -->";
    }
    add_action('thesis_hook_after_comment_meta','start_adsense'); add_action('thesis_hook_after_comment','end_adsense');

    Finally what about Thesis Teasers? If you are using Teasers on the homepage and archive pages then you will want to target the text contained in the teasers. So here is the code for Adsense Section Targeting for Thesis Teasers.

    // Adsense Section Targeting for teasers
    function start_adsense(){
    echo "<!-- google_ad_section_start -->";
    }
    function end_adsense(){
    echo "<!-- google_ad_section_end -->";
    }
    add_action('thesis_hook_before_teaser','start_adsense');
    add_action('thesis_hook_after_teaser','end_adsense');

    Summing it all up, here is the entire code for the ultimate Adsense Section Targeting in Thesis.

    // Adsense Section Targeting
    function start_adsense(){
    echo "<!-- google_ad_section_start -->";
    }
    function end_adsense(){
    echo "<!-- google_ad_section_end -->";
    }
    add_action('thesis_hook_before_post','start_adsense'); // Adsense targeting for posts
    add_action('thesis_hook_after_post','end_adsense');
    add_action('thesis_hook_before_teaser','start_adsense'); // Adsense targeting for teasers (optional)
    add_action('thesis_hook_after_teaser','end_adsense');
    add_action('thesis_hook_after_comment_meta','start_adsense'); // Adsense targeting for comments (optional)
    add_action('thesis_hook_after_comment','end_adsense');

    Warning: Direct copy-pasting of code from this page may give you invalid characters.

  • HOW TO: Create A Member Login Bar In Thesis Header

    In this tutorial I will show you how you can create a cool member bar on your Thesis site that will:

    1. Show a login link to visitors who are not logged in
    2. Upon logging in, redirects users to the same page they were on
    3. Show logout link to logged in users
    4. Show links to dashboard, user profile and so on
    5. Show gravatar of the logged in user

    Coolness aside, it is a great way to present the more frequently used admin links right on the frontend so that the casual contributor doesn’t have to find his way out through a complicated dashboard interface! This is particularly useful for multi-author blogs.

    I prefer to place the member links at the very top, in the Thesis header above the navigation menu, as seen on Bong Buzz. With the following code you can achieve that. You may also want to place it in the sidebar or footer for which you need to call the function in the appropriate hook – should be easy if you are acquainted with Thesis hooks – and modify the HTML and CSS accordingly. You can also add a welcome message to greet your users once they log in.

    Although this guide is written keeping Thesis users in mind, it is applicable to any WordPress theme as well. A generalised code for any WordPress theme is given at the end of this post.

    Let’s start defining a function and name it ‘memberbar’.


    function memberbar() {
    if ( is_user_logged_in() ) { ?>
    <ul class="login">
    <?php global $user_email;
    echo get_avatar($user_email, 13);?>
    <li><a href="/wp-admin/profile.php" title="User Profile"><?php  global $current_user;
    get_currentuserinfo();
    echo($current_user->user_firstname . " " . $current_user->user_lastname . "");
    ?></a></li>
    <li><a href="/wp-admin/post-new.php" title="Write New Post">Write</a></li>
    <li><a href="/wp-admin/" title="Dashboard">Dashboard</a></li>
    <li class="noborder"><a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a></li>
    </ul>
    <?php
    } else {
    ?>
    <ul class="login"><li class="noborder"><a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a></li></ul>
    <?php }
    }

    Now you call the funtion ‘login’ we just created anywhere you wish the member bar to appear. Pretty neat, right? 🙂

    function top_nav_menu() {?>
    <div id="top_nav_menu">
    <ul>
    <li><a href="<?php echo get_bloginfo ('url'); ?>" title="Home">Home</a></li>
    </ul>
    <?php memberbar(); ?>
    </div>
    <?php
    }
    add_action('thesis_hook_before_header', 'top_nav_menu');

    I am quoting the relevant portions from my CSS which will give you a member login bar similar to the one on bongbuzz.net. You should modify it as per your need, especially the measurements.


    #top_nav_menu {
    height:27px;
    }
    #top_nav_menu ul {
    list-style-image:none;
    list-style-type:none;
    margin:0;
    padding-top:7px;
    padding-left:5px;
    float:left;
    }
    #top_nav_menu li {
    border-right: 1px solid #aaa;
    display: inline;
    text-decoration:none;
    }
    #top_nav_menu ul.login {
    padding-left:0;
    float:right;
    padding-right:5px;
    }
    #top_nav_menu li.noborder
    {
    border-right: 0px;
    }
    #top_nav_menu li a {
    padding:0 10px;
    }
    #top_nav_menu li a:hover {
    text-decoration:underline;
    }

    Code for WordPress themes in general:

    <div id="top_nav_menu">
    <ul>
    <li><a href="<?php echo get_bloginfo ('url'); ?>" title="Home">Home</a></li>
    </ul>
    <?php if ( is_user_logged_in() ) { ?>
    <ul class="login">
    <?php global $user_email;
    echo get_avatar($user_email, 13);?>
    <li><a href="/wp-admin/profile.php" title="User Profile"><?php  global $current_user;
    get_currentuserinfo();
    echo($current_user->user_firstname . " " . $current_user->user_lastname . "");
    ?></a></li>
    <li><a href="/wp-admin/post-new.php" title="Write New Post">Write</a></li>
    <li><a href="/wp-admin/" title="Dashboard">Dashboard</a></li>
    <li class="noborder"><a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a></li>
    </ul>
    <?php
    } else {
    ?>
    <ul class="login"><li class="noborder"><a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a></li></ul>
    <?php } ?>
    </div>

    Warning: Direct copy-pasting of code from this page can give you invalid characters.

    Hope you find this useful. 🙂

  • Poila Boisakh Break

    Add B.R. Ambedkar’s birthday to the Bengali New Year, throw in a Saturday and a Sunday and wow! you get a good enough excuse for a short break! 😀 As it turns out I made perfect use of this recipe for holiday and got back home in this scorching Kolkata heat. In all that heat and humidity, I stayed more at home and less outside, ate all the good foods mom made and took lots of sleep, trying my best to correct my sleep-wakefulness cycle.

    I spent a lot of energy to revamp the look of Bong Buzz. The new look is 70% complete. (Please check it out at http://www.bongbuzz.net) I need to make a logo for the site in the coming days. There is also a lot of new posts there.

    During this holiday, I got a new phone. It’s a Sony Ericsson, no-frills 3g phone with focus on fast browsing. The model is T715 and I got it from Anandamela for 9.25k.

  • Visit To SIT

    The gaming competition to be held at SIT was called off! Well we went there and waited for a good many hours and the games were slowly starting but then came the announcement that it’s cancelled! Crapola! Anyways, we made good use of the time eating in the canteens. They have a small but nice campus. The architecture of the main building was quite spectacular – spread in a circle with a central atrium with a lot of light coming through the translucent dome at the top. All Techno colleges have a similar architecture, I’m told. And we played carrom too! Their carrom board was sparkling new, our dilapidated hostel board a far cry from that! They have a fine basketball court with a neat gallery alongside for the audience. The computer lab room which was converted into the gaming room boasted of some 60 HP terminals with 19 inch displays. Most students except the final year people and some 3rd years wore uniforms. Vitamin G is in vogue and they were smoking it in open daylight in the nooks and corners of the campus. We came to know the reason why the event was cancelled. Apparently it had to do something with disputed semester results. The guys who were conducting the event were really polite though. They were really apologetic and returned entry fees to 2 of us who already paid up and played. One of them called us in the evening to inform that it is going to be held tomorrow again. But I don’t think I’ll be going. Can’t waste precious final year time!

  • Game Mode!

    Well there is a gaming competition at SIT (Siliguri Institute of Technology) on 5th! I have participated in Rise of nations. In case you don’t know, well this one is pretty similar to Age of Empires. Only there you fought with elephants and horses but in RON you got nukes! I don’t have much practice really. Last I played this game was in July! Let me see if I can do much in a day!

  • Media Mention

    Guess what I got mentioned in a Bangladeshi newspaper! For my association with OmicronLab. I was really surprised to see my name there. The newspaper in question is a relative newcomer there I am told. But still I’m amused to see my name in print.

    Here’s the article: ?????? ?????? ???????. They spelt my name wrong!

  • Google Stole My Idea?

    So it seems! Google has been repeatedly stealing my ideas when it comes to naming. First it was Google Wave (as in Niponwave)! Now it has to be Google Buzz (from Bong Buzz)!

    Darn you Google.

  • Back From Gangtok

    It has been a week I am back in hostel and the wards are in full swing. I have started jotting down the Gangtok experience before the memory fades. Please read it http://www.bongbuzz.net/2010/01/22/sikkim-trip/

  • Eagerly Awaiting The Green Party

    The shadowy and murky state of politics in India could get a fresh lease of life if the country gets its own Green party. Taking cues from the Europe and US, the Green Party in India is being spearheaded by no other than Subhash Dutta, noted environment activist from Kolkata, who has already been in talks with the Green Party leaders (TOI) of Europe. If everything goes well, the Green Party is going to be a reality all too soon and will be contesting the WB Assembly elections in 2011. Sick and tired of the existing parties and their shady politcal gameplans , I can’t wait for the Green Party to launch – I am already citing Green Party of India as my political inclination on Facebook and following @green4india on Twitter! I would love to see them in the political fray and sure enough, vote for them!

    Subhas Dutta vs Subhash Chakraborty
    Subhash Dutta vs Subhas Chakraborty, ex-transport minister

    Cartoon courtesy: The Telegraph

  • Why Bitstream Isn’t Cool

    Folks continue to be baffled when they see leading newspapers like Anandabazar, Pratidin, Aajkaal are still using Bitstream on their websites. I discussed this on the Omicronlab forum sometime ago.

    Well the reasons why Anandabazar continues to use Bitstream on their site are pretty lame. Here they go –

    1. If they used Unicode many people would not be able to view the text. But that is a very lame reason I tell you. If it was 5-6 years ago, it would have made some sense. People who are using the internet and reading news online are tech-savvy enough. A few instructions for Windows 2000/XP users will be enough. (I dont see 98 anywhere these days).
    2. They are ignorant. They don’t know Unicode is the universal way to display Bengali text. BBC Bengali (bbc.co.uk/bengali), Wikipedia (bn.wikipedia.org) are with the time and use Unicode on their site.
    3. They are lazy. Even if they understand that bitstream (that requires an installation) is cumbersome and Unicode is the standard, they are lazy to shift. Lazy to convert their archive to unicode and lazy to get rid of their current software setup.
    4. They are not serious. They are not taking the internet seriously. They are in no mood to spare a thought for website upgradation.

    The Bitstream has many disadvantages, which I am sure the readers of these newspapers have faced.

    1. Only Windows supported, not Linux or Mac.
    2. Only Internet Explorer supported. Not Firefox, Chrome or Opera.
    3. An installation is required by the user!
    4. Obsolete technology.
    5. The text is useless. You cant copy it.
    6. The text can’t be indexed by search engines either.

    It has one advantage though! For windows 98 users, this was a good way to see Bengali text on web. (Microsoft has phased out support for 98 long ago thereby sending it to the museum)

    It is a pity that our leading newspapers are not using Unicode. But in the long run they will have to make the switch. Did I say long run? They must shift to Unicode immediately!