Theme Hacking – Part 2

Before I get started here I thought I would just give a quick ‘hat tip’ to mg12 for creating such a great free theme. I’ve only worked on 4 blogs to this point but I’ve been through many themes. This one is an absolute pleasure to work with! Thanks!

However, there were just a few more things I wanted to do.

My installation of Disqus broke the comment links on the single post page. (single.php)

Theme Hack

Neither of these links went anywhere as they were making calls to the internal WordPress comment system. Since we’re using Disqus we’ll have to code things a tad differently.

In single.php

<span class="date"><?php the_modified_time(__(‘F jS, Y’, ‘inove’)); ?></span>
            <div class="act">
                <?php if ($comments || comments_open()) : ?>
                    <span class="comments"><a href="#comments"><?php _e(‘Goto comments’, ‘inove’); ?></a></span>
                    <span class="addcomment"><a href="#respond"><?php _e(‘Leave a comment’, ‘inove’); ?></a></span>

Since Disqus does the job for both of these links we can simply remove the line making the #comment reference.

<span class="date"><?php the_time(__(‘F jS, Y’, ‘inove’)); echo ‘. Posted By <a title="author" href="’; the_author_url(); echo ‘">’; the_author(); echo ‘</a>’; ?></span>
            <div class="act">
                <?php if ($comments || comments_open()) : ?>
                    <span class="addcomment"><a href="#disqus_thread"><?php _e(‘Leave a comment’, ‘inove’); ?></a></span>

While here, I added author info to the single post display just like we did previously for the front page. Also we changed #respond to #disqus_thread in our link reference.

While working in single.php I thought I would add code to display an Adsense block just after the post but before the comments. I’ve been told this is a prime ad spot so I thought I would take advantage of it.

Unlike the sidebar ads which were inserted using Text Widgets this had to be hard coded into the theme page. (single.php)

<p class="under">
                <?php if ($options[‘categories’]) : ?><span class="categories"><?php the_category(‘, ‘); ?></span><?php endif; ?>
                <?php if ($options[‘tags’]) : ?><span class="tags"><?php the_tags(”, ‘, ‘, ”); ?></span><?php endif; ?>
            <p align="center"><script type="text/javascript"><!–
google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
/* 468×60, created 12/26/08 */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
<script type="text/javascript"

Finding the code which displays categories and tags, I inserted my adsense code between that and the call to the comments function. Tucked in nicely. :)

Theme Hack

Now that I’m making millions (ha!) I turned to my final task.

I’ve always found that having a comment link at the end of the post is preferable to me than at the top. This theme only features a comment link at the top of the post. We don’t want to move it, we just want to add another at the end of the post.

In index.php

<?php if ($options[‘tags’]) : ?><span class="tags"><?php the_tags(”, ‘, ‘, ”); ?></span><?php endif; ?>
                    <span class="comments"><?php comments_popup_link(__(‘No comments’, ‘inove’), __(‘1 comment’, ‘inove’), __(‘% comments’, ‘inove’)); ?></span>

We simply duplicate the code used at the top of the post and insert it after the category and tag code at the bottom.

Theme Hack

Now that the user has read the post, there’s a handy link right there to make a comment.

I was honestly expecting this Theme Hacking series to go on a bit more. But, thanks to such great work by the theme author, I think I just might be done hacking. :)

I bet some of you are wondering about why I’m posting about such simple tasks. Two words: relevant content baby! While I’ve been screwing around getting things setup I’ve been seeing hits for search terms such as: ShareThis, ‘startup wordpress blog’ and most recently, ‘disqus startup’ All of these are due to the content I’ve added up to this point.

A head start, so to speak. :)

  • free satellite keys

    Development of digital technologies occurs prompt rates. Does not lag behind progress and digital TV. Speaking about digital TV, we first of all mean satellite TV. The digital satellite TV becomes more and more accessible to simple users. The market paid satellite tv also is not necessary on a place. The new digital standard of TV of high clearness HDTV actively develops and takes root. The satellite TV becomes more and more directed on the spectator. Besides digital quality of the image, advantage of satellite systems also is also the extensive cover zone of the companion.