SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2005
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need big time PHP help

    I am having a problem with my site http://techpad.net. I am using the kiwi theme and plugins to customize my blog to my liking and i really like what it is doing, but I have run into some problems. What it was originally intended to do was put the most recent post right underneath the header and then recent posts with small excerpts in a smaller column right below it. However, I do not want that. I want the small colum on the right to display recent posts, like it is doing now, and the small column on the left to display google adsense. It worked fine with one post but once I added another post everything started screwing up which you can probably see by clicking on the link. This is because the main php file is a loop that counts the posts so for every post it will keep posting my adsense all over the page which I do not want. I just want a static google adsense right next to a static recent posts column. I have tried messing with the main php file but with little knowledge I can't figure out how to adjust it to my liking. My goal is to just have the most recent post right in the middle of the page below the header, like it is now, and right below that have the two smaller columns display google and recent posts respectively. Its hard for me to explain this idea, so I hope I explained well enough for you to understand. I will post the code for the main loop file and if you can tell me how to turn the loop off and have it just display the most recent post it would be much appreciated.

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2005
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the code:

    <?php
    // This file is the Wordpress Loop, with a lot of conditional Kiwi tags for counting and such.
    // To edit Template Tags and layout, open firstPost.php, subPost.php, and listPost.php
    // Be careful not to disturb the Kiwi code.
    //
    // If you're unsure, check out the Kiwi help pages: http://no.oneslistening.com/?pagename=kiwi
    ?>

    <?php if (have_posts()) : ?>

    <div id="column1">

    <?php $post_counter = 0 ?>
    <?php while (have_posts()) : the_post(); ?>

    <?php if($post_counter == 0) { ?>

    <?php include (TEMPLATEPATH . "/firstPost.php"); ?>

    <?php } elseif($post_counter <= get_kiwi_option('leftPosts') && $post_counter != 0) { ?>
    <?php if($post_counter == 1) echo '<div class="subcolumn1">'; ?>

    <?php include (TEMPLATEPATH . "/subPost.php"); ?>

    <?php if($post_counter == get_kiwi_option('leftPosts')) echo '</div>'; ?>

    <?php } elseif($post_counter > get_kiwi_option('leftPosts') && $post_counter - get_kiwi_option('leftPosts') <= get_kiwi_option('rightPosts') && $post_counter != 0) { ?>
    <?php if($post_counter - 1 == get_kiwi_option('leftPosts')) echo '<div class="subcolumn2">'; ?>

    <?php include (TEMPLATEPATH . "/subPost.php"); ?>

    <?php if($post_counter == get_kiwi_option('rightPosts') + get_kiwi_option('leftPosts')) echo '</div>'; ?>

    <?php if($post_counter - get_kiwi_option('leftPosts') == get_kiwi_option('rightPosts')) { ?>
    <br clear="all"/><div class="blockLine"></div>

    <div class="subcolumn1">
    <h6>Recent Posts</h6>
    <?php } ?>

    <?php } else { ?>

    <?php include (TEMPLATEPATH . "/subpost.php"); ?>

    <?php } ?>

    <?php $post_counter++ ?>
    <?php endwhile; ?>


    </div> <?php // end subcolumn1 div ?>

    <div class="subcolumn2">
    <h6>Recent Posts</h6>
    <?php $mini_query = new wp_query('showposts=10&orderby=date'); ?>
    <?php while ($mini_query->have_posts()) : $mini_query->the_post(); update_post_caches($posts); ?>
    <div class="recent">
    <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>"><?php the_title(); ?></a></h4>
    <p class="postmetadata">Filed under <?php the_category(', ') ?>. Created on <?php the_time('F jS') ?>.</p>
    </div>
    <?php endwhile; ?>
    </div>

    <?php if(get_kiwi_option('category-menu') == 'true' && function_exists('cat_footer')) cat_footer(); ?>

    </div>

    <?php else : ?>

    <?php include (TEMPLATEPATH . "/noposts.php"); ?>

    <?php endif; ?>

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2005
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i decided to scrap the idea and just go for the normal layout for now. However, if anyone has ever modified Kiwi before, I would gladly recommend any tips you have.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •