• Resolved fotonarya

    (@fotonarya)


    I would like to have a different sidebar for the posts page then the static front page. Using widgets on both.
    I already have simple catch child theme and add this code in function.php

    if ( function_exists( 'register_sidebar' ) ) {
    	register_sidebar( array(
    		'name'          => __( 'Home', 'simplecatch' ),
    		'id'            => 'home',
    		'description'   => __( 'Sidebar homepage', 'simplecatch' ),
    		'before_widget' => '<div class="widget">',
    		'after_widget'  => '</div>',
    		'before_title'  => '<h3>',
    		'after_title'   => '</h3><hr/>'
    	) );
    }

    and replace this code in sidebar.php

    if ( function_exists( 'dynamic_sidebar' ) ) {
    		//displays 'sidebar' for all pages
    		dynamic_sidebar( 'sidebar' );
    	}
    	?>

    with this code

    if ( function_exists('dynamic_sidebar')):
    		if (is_home())
    			dynamic_sidebar('home');
    		else dynamic_sidebar('sidebar');
    		endif;

    but it’s doesn’t work 🙁
    Please advice….

    Thanks,

    http://wordpress.org/extend/themes/simple-catch/

Viewing 5 replies - 1 through 5 (of 5 total)
  • you don’t need to replace the code in sidebar.php code but add this code in index.php or where it sidebar.php is being included.

    Thread Starter fotonarya

    (@fotonarya)

    @satty005 already add the code to index.php, but still cannot get this work.
    Please tell me, what exactly i have to do
    I’m not a kind of expert in this coding world

    Thanks,

    Theme Author Catch Themes

    (@catchthemes)

    @fotonarya: Four function.php code looks fine. But your sidebar.php should be like this:

    global $post;
    	if( $post )
    		$layout = get_post_meta( $post->ID,'simplecatch-sidebarlayout', true ); 
    
    	if( empty( $layout ) || ( !is_page() && !is_single() ) )
    		$layout='default';
    
    	global $simplecatch_options_settings;
        $options = $simplecatch_options_settings;
    
    	$themeoption_layout = $options['sidebar_layout'];
    
    	if( $layout=='left-sidebar' ||( $layout=='default' && $themeoption_layout == 'left-sidebar') ) {
    		echo '<div id="sidebar" class="col4 no-margin-left">';
    	} else {
    		echo '<div id="sidebar" class="col4">';
    	} 
    
    	if ( function_exists( 'dynamic_sidebar' ) ) {
    		if  ( is_home() || is_front_page() ) {
    			//displays 'sidebar' for all pages
    			dynamic_sidebar( 'home' );
    		} else {
    			//displays 'sidebar' for all pages
    			dynamic_sidebar( 'sidebar' );
    		}
    	}
    
    	?>
    	</div><!-- #sidebar -->
    
    	<?php
    	if(!( $layout=='left-sidebar' ||( $layout=='default' && $themeoption_layout == 'left-sidebar') ) ) {
    		echo '<div class="row-end"></div>';
    	}

    Thread Starter fotonarya

    (@fotonarya)

    @sakin thanks, you are rock
    your code work like a champ

    and thanks again for the great theme

    Thread Starter fotonarya

    (@fotonarya)

    *forgeted to mark it with resolved*

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Theme: Simple Catch] Different sidebar in homepage’ is closed to new replies.