WordPress.org

Support

Support » Themes and Templates » Customizr » Add widgetized area

Add widgetized area

  • I want to add a widgetized area to the home page that will come after the posts, but before the footer area widgets.

    Any ideas on how to do this?

    I tried following other tutorials on adding a widgetized area, but I believe the customizr theme is organized differently.

    Any help is greatly appreciated. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    @manavkumar – please see the forum guidelines on posting code

    http://codex.wordpress.org/Forum_Welcome#Posting_Code

    And please also advise people to make those kinds of changes only in a child theme.

    WPyogi

    @wpyogi

    Forum Moderator

    I had fixed your code once, then evidently you changed it , so repost it using the code buttons.

    @WPyogi- thanks for suggestion and i will follow the guidelines

    if you want to add new widgetized area then do some change in your child theme (or custom theme but not in default theme) and follows these steps

    step 1: open function.php file in your child theme and paste this code in it

    register_sidebar( array(
    	'name' => __( 'Sidebar Left Widget', 'twentyeleven-child' ),
    	'id' => 'header-widget',
    	'before_widget' => '<div id="%1$s" class="widget %2$s">',
    	'after_widget' => "</div>",
    	'before_title' => '<h3 class="widget-title">',
    	'after_title' => '</h3>',
    ) );
    
    function twentyeleven_posted_on() {
    	$link= esc_url( get_permalink() );
    	$title= esc_attr( get_the_title() );
    	$time= esc_attr( get_the_time() );
    	$dateGMT= esc_attr( get_the_date( 'c' ) );
    	$date= esc_html( get_the_date() );
    	$authorURL= esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
    	$author= esc_html( get_the_author() );
    
    	echo ('<span class="sep">Posted on</span> <a href="'.$link.'" title="'.$title.'" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>'.$date.' at '. $time.'</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="'.$authorURL.'" title="'.$author.'" rel="author">'.$author.'</a></span>');
    
    }
    
    function techild_header_widget(){
    	if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Sidebar Left Widget' ) ) :
    		get_search_form();
    	endif;
    }

    step 2: now open those pages in which you want to show widget area like index.php file or page.php file or custom tempalate files in your child theme and paste this code where you want to show widget area.

    <?php
    if ( 'content' != $current_layout ) :
    ?>
    		<div id="header_right" class="widget-area" role="complementary">
    			<?php techild_header_widget(); ?>
    		</div><!-- #header_right .widget-area -->
    <?php endif; ?>

    please don’t change anything in your default theme. Always do your work in custom theme or child theme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add widgetized area’ is closed to new replies.
Skip to toolbar