WordPress.org

Ready to get started?Download WordPress

Forums

Swanky Theme: 2nd Sidebar not appearing in Widget interface (2 posts)

  1. antorera
    Member
    Posted 4 years ago #

    Hello,

    I just installed the Swanky template (on a local server).
    http://www.freewpthemes.net/preview/swanky

    One of the reasons for choosing it was the the 3-columns. The two right-hand sidebars show up when viewing the site with "Recent Posts" in the first column and "Categories" in the second.

    When I go into the widget interface, there is only Sidebar1 as an option, which controls the outer column. I can add and remove any widgets I like and they appear there on the site.

    However, there is no way for me to edit the inner sidebar, yet it is appearing on the site with just "Recent Posts".

    I took a peek at the sidebar.php file and it only has a reference to Sidebar2, which is weird as that's the one not showing up.

    Any suggestions on how I can get it to appear in WP admin?

    Thanks.

  2. antorera
    Member
    Posted 4 years ago #

    Okay, I'm not a programmer, but I compared this theme with another and I think I was able to resolve the problem.

    To make the Swanky theme work, you have to fix several items. Use the Flourish theme (by same programmers) as a good example.

    1) Change the functions.php file and make a call to the second sidebar (there is only a call for one sidebar). Delete all the code that is there (one call to the first sidebar) and insert this correct code:

    <?php
    
    if (function_exists('register_sidebar'))
    {
    
    	register_sidebar(
    		array(
    			'name'          => 'Sidebar1',
    	        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        	    'after_widget'  => '</li>',
            	'before_title'  => '<h2 class="widgettitle">',
            	'after_title'   => '</h2>'
    		)
    	);
    
    	register_sidebar(
    		array(
    			'name'          => 'Sidebar2',
    	        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        	    'after_widget'  => '</li>',
            	'before_title'  => '<h2 class="widgettitle">',
            	'after_title'   => '</h2>'
    		)
    	);
    
    }
    
    ?>

    2) Change the sidebar.php file. Delete the swanky version and just copy the one from the Flourish theme. Correct code is:

    <!-- start sidebars -->
    <div id="sidebar1" class="sidebar">
    	<ul>
    	<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar1')): ?>
    		<li>Please add some widgets here.</li>
    	<?php endif; ?>
    	</ul>
    </div>
    <div id="sidebar2" class="sidebar">
    	<ul>
    	<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar2')): ?>
    		<li>Please add some widgets here.</li>
    	<?php endif; ?>
    	</ul>
    </div>
    <!-- end sidebars -->

    3) in the Index.php and Page.php files, remove the section for Sidebar1

Topic Closed

This topic has been closed to new replies.

About this Topic