Add widgetized area (6 posts)

  1. rayhbanks
    Posted 1 year ago #

    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.

  2. manavkumar
    Posted 1 year ago #

  3. WPyogi
    Forum Moderator
    Posted 1 year ago #

    @manavkumar - please see the forum guidelines on posting code


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

  4. WPyogi
    Forum Moderator
    Posted 1 year ago #

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

  5. manavkumar
    Posted 1 year ago #

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

  6. manavkumar
    Posted 1 year ago #

    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' ) ) :

    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.

    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.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic