{"id":1022,"date":"2009-07-24T23:02:13","date_gmt":"2009-07-24T23:02:13","guid":{"rendered":"http:\/\/tricks-collections.com\/?p=1022"},"modified":"2013-05-02T03:38:21","modified_gmt":"2013-05-02T03:38:21","slug":"wordpress-themes-hack","status":"publish","type":"post","link":"http:\/\/tricks-collections.com\/wordpress-themes-hack\/","title":{"rendered":"WordPress Themes Hack"},"content":{"rendered":"

This wordpress themes hack has tested. Modifying the wordpress themes code can cause your wordpress themes error. We cannot guarantee that problems resulting from modifications the wordpress themes. Use this tutorial at your own risk. I have tried all that mentioned here in wordpress 2.7, wordpress 2.7.1 and wordpress 2.8 and all wordked.<\/p>

A. Embed Google Adsense In First WordPress Post<\/strong><\/p>

To place an ad after the first post title in your WordPress blog main page<\/p>

<\/p>

  1. Open the WordPress admin control panel and \tnavigate to: Presentation > \tTheme Editor<\/li>
  2. Select the Main \tIndex Template (index.php) from the \tlist of templates on the right.<\/li>
  3. In the Main Index Template, find the line that \tstarts with:

    <?php if \t(have_posts())<\/p><\/blockquote> <\/li>

  4. Add the following line above it:

    <?php \t$count = 1; ?><\/p><\/blockquote> <\/li>

  5. Next, find the line that starts with:

    <?php \tthe_content<\/p><\/blockquote> <\/li>

  6. After the closing tag ?> \tfor that section (it may wrap to multiple lines), add the following \tcode:

    <?php if ($count == 1) : ?>
    \u2013 Insert your Google AdSense code here \u2013
    <?php endif; $count++; ?><\/p><\/blockquote> <\/li>

  7. Click Update \tFile.<\/li> <\/ol>

    This places the ad within the first post.\u00a0 If instead you want the ad to appear between the first and second post, add the code from step 6 after the closing <\/div> tag for the \u201centry\u201d div that contains the line <?php the_content.<\/p>

    Source: http:\/\/www.devtopics.com\/embed-google-ad-in-first-wordpress-post\/<\/a><\/p>

    B. Adding Comment Numbers To Your WordPress Theme<\/strong><\/p>

    Here are the steps you can take to easily add numbers to your WordPress theme\u2019s comments section.<\/p>

    1. First thing you will want to do is create a backup your comments.php \tfile.<\/li>
    2. Locate the \tcomments.php file.<\/li>
    3. Locate the code \tthat starts the comment loop. It will look something like \tthis:

      <?php \tif ( $comments ) : ?><\/p><\/blockquote> <\/li>

    4. Place this code \timmediately above the code in Step 3:

      <?php \t$i = 0; ?><\/p><\/blockquote> <\/li>

    5. Now locate the \tcode that looks like this:

      <?php \tforeach ($comments as $comment) : ?><\/p><\/blockquote> <\/li>

    6. Placed this \tcode immediately below the code in Step 5:

      <?php \t$i++; ?><\/p><\/blockquote> <\/li>

    7. Now use this \tcode where you want to display your comment numbers:

      <span \tclass=”count”>
      <?php \techo $i; ?>
      <\/span><\/p><\/blockquote> <\/li>

    8. Click Save.<\/li>
    9. Now go to \tyour stylesheet (style.css) and place this code anywhere on the \tstylesheet (probably best placed in the comments section):

      .count \t{
      float:right;
      padding: \t10px;
      font-size:18px;
      color:#000000;
      }<\/p><\/blockquote> <\/li> <\/ol>

      You can adjust the stylesheet to fit your comment numbers into the placement and appearance that you want them to have.<\/p>

      Source: http:\/\/wphacks.com\/how-to-adding-comment-numbers-to-your-wordpress-theme<\/a><\/p>

      C. Separate WordPress Comments and Trackbacks<\/strong><\/p>

      1. Access your comments.php file and \tlocate the following code:

        <?php foreach ($comments as $comment) : ?><\/p><\/blockquote> <\/li>

      2. Immediately after the above code, you\u2019ll want to place this code:

        <?php $comment_type = get_comment_type(); ?>
        <?php if($comment_type == ‘comment’) { ?><\/p><\/blockquote> <\/li>

      3. Next, you\u2019ll want to scroll down \ta little bit and locate the following code:

        <?php endforeach; \/* end for each comment *\/ ?><\/p><\/blockquote> <\/li>

      4. Immediately before the above code, you\u2019ll want to place this code:

        <?php } \/* End of is_comment statement *\/ ?><\/p><\/blockquote>

        This will filter out all of the trackbacks and pingbacks from your main comments loop. Now we need to create a second comments loop to display the trackbacks and pingbacks.<\/li>

      5. Almost immediately below the code \tfrom step 2 you should find this code:

        <?php else : \/\/ this is displayed if there are no comments so far ?><\/p><\/blockquote>

        Immediately before the above code, you\u2019ll want to place this code:<\/p>

        <h3>Trackbacks<\/h3>
        <ol>
        <?php foreach ($comments as $comment) : ?>
        <?php $comment_type = get_comment_type(); ?>
        <?php if($comment_type != ‘comment’) { ?>
        <li><?php comment_author_link() ?><\/li>
        <?php } ?>
        <?php endforeach; ?>
        <\/ol><\/p><\/blockquote>

        You can adjust this code to display how you want to, including using a different header if you have a specific look for your header 3.<\/li> <\/ol>

        Source: http:\/\/wphacks.com\/how-to-separate-wordpress-comments-and-trackbacks<\/a><\/p>

        D. Display the most commented posts<\/strong><\/p>

        Copy and paste following code to your wordpress themes to display most commented post.<\/p>

        <h2>Most commented posts<\/h2>
        <ul>
        <?php
        $result = $wpdb->get_results(“SELECT comment_count,ID,post_title, post_date FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10″);
        foreach ($result as $topten) {
        $postid = $topten->ID;
        $title = $topten->post_title;
        $commentcount = $topten->comment_count;
        if ($commentcount != 0) {
        ?>
        <li><a href=”<?php echo get_permalink($postid); ?>”><?php echo $title ?><\/a><\/li>
        <?php }
        }
        ?><\/p><\/blockquote>

        Source: http:\/\/www.wprecipes.com\/how-to-display-the-most-commented-posts-of-2008<\/a><\/p>

        E. WordPress Recent Posts from specific category<\/strong><\/p>

        <ul>
        <?php $recent = new WP_Query(“cat=catID<\/span>&showposts=10″); while($recent->have_posts()) : $recent->the_post();?>
        <li><a href=”<?php the_permalink() ?>” rel=”bookmark”>
        <?php the_title(); ?>
        <\/a><\/li>
        <?php endwhile; ?>
        <\/ul><\/p><\/blockquote>

        Replace catID with post category to be displayed.<\/p>

        Source: http:\/\/www.readywpthemes.com\/wordpress-recent-posts-from-specific-category\/<\/p> ","protected":false},"excerpt":{"rendered":"

        This wordpress themes hack has tested. Modifying the wordpress themes code can cause your wordpress themes error. We cannot guarantee that problems resulting from modifications the wordpress themes. Use this tutorial at your own risk. I have tried all that mentioned here in wordpress 2.7, wordpress 2.7.1 and wordpress 2.8 and all wordked. A. Embed […]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[5],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/posts\/1022"}],"collection":[{"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/comments?post=1022"}],"version-history":[{"count":1,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/posts\/1022\/revisions"}],"predecessor-version":[{"id":9736,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/posts\/1022\/revisions\/9736"}],"wp:attachment":[{"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/media?parent=1022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/categories?post=1022"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tricks-collections.com\/wp-json\/wp\/v2\/tags?post=1022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}