WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 2 Sidebar Widget Areas (14 posts)

  1. rusticblonde
    Member
    Posted 1 year ago #

    http://rusticblonde.byethost22.com/TestSite/

    Hi there,

    can anyone help me Im lost as to why i have 2 boxes for the 2nd sidebar area.

    I have inserted the get_sidebar code into both the page.php and the index.php

    and removing the page one removes them both,

    I basically want this to sit below the content.

    Can anyone help please.

    thanks
    Kirsty

  2. rusticblonde
    Member
    Posted 1 year ago #

    actually ive just found it once, in the page.php file.

    Is it because im trying to call the 2 bars in 1 area?

    thanks

  3. rusticblonde
    Member
    Posted 1 year ago #

    <?php get_header(); ?>
    
    	<div id="content">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    		<div class="post">
    
    			<div class="entry">
    				<?php the_content('Read the rest of this entry ยป'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			</div>
    
    		</div>
    
    		<?php endwhile; ?>
    
    	<?php else : ?>
    
    		<h2>Not Found</h2>
    		<p>Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif; ?>
    
    	</div>
    	<!--/content -->
    
    <?php get_sidebar(); ?>
    <?php get_sidebar('second'); ?>
    <?php get_footer(); ?>

    This is my code for the page.php file

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  4. rusticblonde
    Member
    Posted 1 year ago #

    well swapped it to main 1 and its still duplicated. Any ideas folks?

    Your help is much appreciated :)

  5. rusticblonde
    Member
    Posted 1 year ago #

    also this is the code for the main1 sidebar

    <div id="sidebar-main1">
    <ul id="sidebar-main1">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('sidebar-main1') ) : ?>
    <?php endif; ?>
    
    </div>

    Sorry for all posts.
    thanks

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  6. rusticblonde
    Member
    Posted 1 year ago #

    Hi Moderators, what do i have to do to get this resolved? Apologies for the mis information.

  7. alchymyth
    Forum Moderator
    Posted 1 year ago #

    what do i have to do to get this resolved?

    possibly be patient and what a bit longer than just 30 minutes?

  8. rusticblonde
    Member
    Posted 1 year ago #

    even with a duplicate alchymyth? As i thought this would suggest that i had pasted the call twice.

    Sorry for the abruptness. Im very new and trying to learn. As usually the changes when i edit the code are instantly viewable

  9. alchymyth
    Forum Moderator
    Posted 1 year ago #

    what are your codes in functions.php for registering the sidebars?

    http://codex.wordpress.org/Function_Reference/register_sidebar

    what is the code of sidebar-second.php?

  10. rusticblonde
    Member
    Posted 1 year ago #

    apologies how to do i put backticks and i will paste the code
    alchymyth

    thankyou for your help

  11. rusticblonde
    Member
    Posted 1 year ago #

    apologies if i post this wrong:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array('name'=>'sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array('name'=>'sidebar-main1',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    register_sidebar(array(
      'name' => __( 'Right Hand Sidebar' ),
      'id' => 'right-sidebar',
      'description' => __( 'Widgets in this area will be shown on the right-hand side.' ),
      'before_title' => '<h1>',
      'after_title' => '</h1>'
    ));
    ?>

    this is my function file

    and my main1 php is:

    <div id="sidebar-main1">
    <ul id="sidebar-main1">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-main1') ) : else : ?>
       <ul>
      </ul>
    <?php endif; ?>
    </ul>
    </div>
  12. alchymyth
    Forum Moderator
    Posted 1 year ago #

    why i have 2 boxes for the 2nd sidebar area.

    seems to be caused by the (invalid) repeated and nested use of the css id #sidebar-main1 in the sidebar file;

    possibly change the css id to a differnt name in one of those lines:

    <div id="sidebar-main1">
    <ul id="sidebar-main1">

    example:

    <div id="sidebar-main-wrap">
    <ul id="sidebar-main1">

    and add corrsponding css to style.css if necessary.

  13. rusticblonde
    Member
    Posted 1 year ago #

    oh sugar! Didnt realise that. I assumed they had to be the same to correspond.

    I will try this.

    Thankyou again

  14. rusticblonde
    Member
    Posted 1 year ago #

    awesomeness alchymyth

    It appears to have worked! I will remember to use a different name to the UL name for extra bars in future.

    Your help has been much appreciated hun.

    Thankyou again

Topic Closed

This topic has been closed to new replies.

About this Topic