• Great theme. Wonderful start for a beginner. As the title says i am trying to add a widget area under the POSTS section on the main page. I looked at a previous post on how to add a widget to the header section, but could not make the changes necessary to fit my need.

    Any help would be greatly appreciated.

    Thanks again.
    aburub

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Aburub

    (@aburub)

    I forgot to add the link to the previous post explaining the header widget.

    Theme Author Richie KS

    (@rkcorp)

    add this to functions.php or create a new file in wp-content/ and name it meso-custom-functions.php and add this code

    function dez_add_mainpost_widgets_init() {
    register_sidebar(array(
    'name'=>__('Main Post', TEMPLATE_DOMAIN),
    'id' => 'main-post',
    'description' => __( 'Main post widget area', TEMPLATE_DOMAIN ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => '</aside>',
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ));
    }
    add_action( 'widgets_init', 'dez_add_mainpost_widgets_init' );

    and add this anywhere you want the widget to show

    <?php
    if ( is_active_sidebar( 'main-post' ) )  {
    dynamic_sidebar( 'main-post' );
    }
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Widget in main page under POSTS’ is closed to new replies.