WordPress.org

Ready to get started?Download WordPress

Forums

How to add extra sidebar in a right colum? (2 posts)

  1. zuper
    Member
    Posted 5 years ago #

    hey everyone!

    i have one small problem i would like to add extra side bar inte to my website Johanelg
    i found some guides but non of them help me.

    as i know i need to change my functions.php

    witch look like this atm:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '', // Removes

  2. 'after_widget' => '', // Removes
  3. 'before_title' => '<h2>', // Replaces <h2>
    'after_title' => '</h2>', // Replaces </h2>
    ));
    ?>

    and change it to:

    <?php
    if ( function_exists('register_sidebars') )
    register_sidebars(2);
    ?>

    and rename my sidebar.php into sidebar1.php

    my sidebar.php looks like this atm:

    <div id="sidebar">

    <div id="searchdiv">
    <form id="searchform" method="get" action="/index.php">
    <input style="text-align:right;padding:5px;font-size:12px;color:#999;font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma, Helvetica, Verdana, sans-serif;" type="text" name="s" id="s" size="22"
    value="Search" onblur="setTimeout('closeResults()',2000); if (this.value == '') {this.value = '';}" onfocus="if (this.value == 'Search') {this.value = '';}" />
    <div style="visibility:hidden"> <input name="sbutt" type="submit" value="Find" alt="Submit" /></div>
    </form></div>

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <h2>Feeds</h2>
    <ul id="feed">

  4. " title="<?php _e('Syndicate this site using RSS'); ?>">RSS Articles
  5. <h2>Monthly Archives</h2>

      <?php wp_get_archives('type=monthly'); ?>

    <h2>Categories</h2>

      <?php wp_list_cats(); ?>
    </div>
    <?php endif; ?>

    </div>

    </div>

    and create a new sidebar "sidebar2.php and put this code:

    <div>

      <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
      <?php endif; ?>

    </div>

    after that i should change my index.php and search for something like this :

    <?php include (TEMPLATEPATH . '/sidebar.php'); ?>

    but problem is that my index.php look like this

    <?php
    get_header();
    ?>
    <?php get_sidebar(); ?>
    <div id="content">
    <?php //include("wp-content/adsense.txt");?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="entry">
    <h3 class="entrytitle" id="post-<?php the_ID(); ?>"> " rel="bookmark">
    <?php the_title(); ?>
    <span id="commentlink"><?php comments_popup_link('0','1','%'); ?></span></h3>
    <div class="entrymeta">
    Posted <?php
    the_time('F j, Y ');
    $comments_img_link= '<img src="' . get_stylesheet_directory_uri() . '/images/comments.gif" title="comments" alt="*" />';
    if (function_exists('enp_edit_link')) { enp_edit_link(__(' Edit This')); }
    else { edit_post_link(__('Edit This')); } ?>
    </div>
    <div class="entrybody">
    <?php the_content(__('Read more »'));?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>
    <?php comments_template(); // Get wp-comments.php template ?>
    <?php endwhile; else: ?>
    <p>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    </p>
    <?php endif; ?>
    <p>
    <?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?>
    </p>
    </div>
    <?php get_footer(); ?>

    hope somone can help me!

  • gimmeblog
    Member
    Posted 5 years ago #

    got the same problem. my index file is different then what tutorials says.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.