• Resolved themaven

    (@themaven)


    I am completely new to WP and code, but also eager to learn from my mistakes! ?? I thought I was following along with the tutorial for adding adsense code, and I seemed to figure it out for the header, but then screwed it up for the sidebar. Now all my widgets are WAY down at the bottom of the screen, not exactly what I’m looking for. I’ve since opted to manage the placement of ads with the MaxBanner plug-in, but I need help fixing the sidebar code (I’m using WP21 theme)…

    Here’s my site for a visual:

    Any ideas on what happened??

    <div id="sidebar">
    
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    <ul>
    
      <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
        <? $sg = 'banner'; include "templates.php";?>
    
        <?php /* Menu for subpages of current page (copied from K2 theme) */
        global $notfound;
        if (is_page() and ($notfound != '1')) {
            $current_page = $post->ID;
            while($current_page) {
                $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
                $current_page = $page_query->post_parent;
            }
            $parent_id = $page_query->ID;
            $parent_title = $page_query->post_title;
    
            // if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status != 'attachment'")) {
            if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_type != 'attachment'")) {
        ?>
    
        <li>
          <h2 class="sidebartitle"><?php echo $parent_title; ?> <?php _e('Subpages'); ?></h2>
          <ul class="list-page">
            <?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?>
          </ul>
        </li>
    
        <?php } } ?>
    
        <li>
          <h2 class="sidebartitle"><?php _e('Categories'); ?></h2>
          <ul class="list-cat">
            <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
          </ul>
        </li>
    
        <li>
          <h2 class="sidebartitle"><?php _e('Archives'); ?></h2>
          <ul class="list-archives">
            <?php wp_get_archives('type=monthly'); ?>
          </ul>
        </li>
    
        <li>
          <h2 class="sidebartitle"><?php _e('Links'); ?></h2>
          <ul class="list-blogroll">
          <?php wp_register(); ?>
    		<li><?php wp_loginout(); ?></li>
            <?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', FALSE, FALSE, -1, FALSE); ?>
          </ul>
        </li>
    
      <?php endif; ?>
    
     </ul>
    
    </div>
    <!--/sidebar -->
Viewing 1 replies (of 1 total)
  • This usually happens when the width of the content div and sidebar div collides. Make sure the Adsense code width isn’t more than the sidebar.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with sidebar after trying to add adsense code’ is closed to new replies.