mods in the theme to show widget area at top of home page

This commit is contained in:
jorge 2022-02-01 08:37:21 +01:00
parent 189cff9bfc
commit 885acdc298
4 changed files with 26 additions and 8 deletions

View File

@ -10,6 +10,15 @@
?> ?>
<?php get_header(); ?> <?php get_header(); ?>
<?php if( is_home( )) : ?>
<?php // show big widget area if homepage and if active ?>
<aside class="hero">
<?php if ( ! dynamic_sidebar( 'secondary-widget-area' ) ) : ?>
<?php endif; // end secondary widget area ?>
</aside>
<?php endif; //end if is_home ?>
<div id="main" class="maingran"> <div id="main" class="maingran">
<div id="content" class="narrowcolumn indexall"> <!-- esborrar class narrowcolumn --> <div id="content" class="narrowcolumn indexall"> <!-- esborrar class narrowcolumn -->

View File

@ -10,6 +10,12 @@
<div id="main"> <div id="main">
<?php if( is_home( )) : ?>
<aside class="hero">
<?php if ( ! dynamic_sidebar( 'secondary-widget-area' ) ) : ?>
<?php endif; // end secondary widget area ?>
</aside>
<?php endif; //end if is_home ?>
<div id="content"> <div id="content">
<?php get_template_part( 'loop', 'index' ); ?> <?php get_template_part( 'loop', 'index' ); ?>
</div> </div>

View File

@ -7,7 +7,7 @@ function ari_widgets_init() {
register_sidebar( array( register_sidebar( array(
'name' => __( 'Primary Widget Area', 'hangar' ), 'name' => __( 'Primary Widget Area', 'hangar' ),
'id' => 'primary-widget-area', 'id' => 'primary-widget-area',
'description' => __( 'Here you can put one or two of your main widgets (like an intro text, your page navigation or some social site links) in your left sidebar. The sidebar is fixed, so the widgets content will always be visible, even when scrolling down the page.', 'ari' ), 'description' => __( 'Here you can put all the widget elements to be shown in the left side menu.', 'ari' ),
'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
'after_widget' => '</li>', 'after_widget' => '</li>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<h3 class="widget-title">',
@ -18,11 +18,11 @@ function ari_widgets_init() {
register_sidebar( array( register_sidebar( array(
'name' => __( 'Secondary Widget Area', 'hangar' ), 'name' => __( 'Secondary Widget Area', 'hangar' ),
'id' => 'secondary-widget-area', 'id' => 'secondary-widget-area',
'description' => __( 'Here you can put all the additional widgets for your right sidebar.', 'hangar' ), 'description' => __( 'Here you can put all the additional widgets elements to be shown in the HomePage big announcement.', 'hangar' ),
'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'before_widget' => '<span id="%1$s" class="widget-container %2$s">',
'after_widget' => '</li>', 'after_widget' => '</span>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<span class="widget-title">',
'after_title' => '</h3>', 'after_title' => '</span>',
) ); ) );
} }

View File

@ -1,3 +1,6 @@
<aside class="hero">
<?php if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
</aside>
<?php /* Start the Loop. */ ?> <?php /* Start the Loop. */ ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>