Add Widget Area for Footer

Hi, we need 6 Widget area for one footer.

How to add?
SC: https://screencast.com/t/MQG5QSiOGaVU

actually i slove it with column shortcode but that is no nice solution for my customer.
[column type=“1/6”] …

thank you

Hi There @domturbo

Thanks for writing in! It is technically possible with custom development, but it will be outside our scope of the support.

If you’re interested in customizing that area, first you need to setup a child theme by following our guide here (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57) and then you can follow this post to locate the file that you want to customize (https://theme.co/apex/forum/t/add-section-to-footer/54603/2?u=mldarshana).

Thanks!

Yes this i have found and i have change a lot :slight_smile:

can you give me an hint, to add two Widget area in footer in the Backend - wp-admin/widgets.php?

i think, somewhere is added an fixed value, that i see only 4 “Boxes” --> in the theme PHP viles, ther is used $I to count.

thank you

Hi @domturbo,

That area will loop depending on what was set in the Theme Options setting for the footer area with a maximum of 4.

If you want to add more columns, you will have to override the _footer-widget-areas.php file to:

<?php

// =============================================================================
// VIEWS/GLOBAL/_FOOTER-WIDGET-AREAS.PHP
// -----------------------------------------------------------------------------
// Outputs the widget areas for the footer.
// =============================================================================

$n = 6;

?>

<?php if ( $n != 0 ) : ?>

  <footer class="x-colophon top">
    <div class="x-container max width">

      <?php

      $i = 0; while ( $i < $n ) : $i++;

        $last = ( $i == $n ) ? ' last' : '';

        echo '<div class="x-column x-md x-1-' . $n . $last . '">';
          dynamic_sidebar( 'footer-' . $i );
        echo '</div>';

      endwhile;

      ?>

    </div>
  </footer>

<?php endif; ?>

Notice that in line 9, $n = x_get_option( 'x_footer_widget_areas' ); was changed to $n = 6; so the code above will loop 6 times which will give you 6 columns.

Hope this helps.

yes and no :slight_smile:
i slove it in this way:

_footer-widget-areas.php
<?php
$n =6;
$i = 0; while ( $i < $n ) : $i++;

    $last = ( $i == $n ) ? ' last' : '';
	
    echo '<div class="x-column x-md footer-widget-koje" id="sidebar-custom-footer' . $i .'">';
      dynamic_sidebar( 'sidebar-custom-footer' . $i );
    echo '</div>';

  endwhile;

  ?>

</div>

functions.php:

function koje_widgets_init() {
register_sidebar( array(
	'name'          => __( 'Custom Footer 1', 'koje' ),
	'id'            => 'sidebar-custom-footer',
	'description'   => __( 'Footer 1', 'koje' ),
	'before_widget' => '<aside id="%1$s" class="widget %1$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

register_sidebar( array(
	'name'          => __( 'Custom Footer 2', 'koje' ),
	'id'            => 'sidebar-custom-footer2',
	'description'   => __( 'Footer 2', 'koje' ),
	'before_widget' => '<aside id="%2$s" class="widget %2$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

register_sidebar( array(
	'name'          => __( 'Custom Footer 3', 'koje' ),
	'id'            => 'sidebar-custom-footer3',
	'description'   => __( 'Footer 3', 'koje' ),
	'before_widget' => '<aside id="%3$s" class="widget %3$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

register_sidebar( array(
	'name'          => __( 'Custom Footer 4', 'koje' ),
	'id'            => 'sidebar-custom-footer4',
	'description'   => __( 'Footer 4', 'koje' ),
	'before_widget' => '<aside id="%4$s" class="widget %4$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

register_sidebar( array(
	'name'          => __( 'Custom Footer 5', 'koje' ),
	'id'            => 'sidebar-custom-footer5',
	'description'   => __( 'Footer 5', 'koje' ),
	'before_widget' => '<aside id="%5$s" class="widget %5$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

register_sidebar( array(
	'name'          => __( 'Custom Footer 6', 'koje' ),
	'id'            => 'sidebar-custom-footer6',
	'description'   => __( 'Footer 6', 'koje' ),
	'before_widget' => '<aside id="%6$s" class="widget %6$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );


}
add_action( 'widgets_init', 'koje_widgets_init' );

Thank you :slight_smile:

Hi @domturbo,

Thanks for providing your solution although it would be more optimal if you just add two more footer widget area and set the ids to footer-THE_NUMBER like this:


function koje_widgets_init() {
    register_sidebar( array(
	'name'          => __( 'Footer 5', 'koje' ),
	'id'            => 'footer-5',
	'description'   => __( 'Footer 1', 'koje' ),
	'before_widget' => '<aside id="%1$s" class="widget %1$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
    ) );

    register_sidebar( array(
	'name'          => __( 'Footer 6', 'koje' ),
	'id'            => 'footer-6',
	'description'   => __( 'Footer 2', 'koje' ),
	'before_widget' => '<aside id="%2$s" class="widget %2$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
    ) );
}

add_action( 'widgets_init', 'koje_widgets_init' );

That way, you can reuse the 4 footer area added by X theme and just add two additional footer area with less change to the _footer-widget-areas.php.

Cheers!

1 Like

Yes you right, thank you.

one other - in the Widget Title - how i can insert an < br > tag? - or is it better to create an “Sub Title” ? or Use HTML Widget element?

thank you

Hi @domturbo,

The widget title doesn’t allow any HTML codes. Please add the sub title to the text content instead:

Hope it helps :slight_smile:

Found an good solution.

function.php:

add_filter('widget_title', 'do_shortcode');

function line_break() {
    return '<br />';
}

add_shortcode('lbr', 'line_break');

Usage in title:
My [lbr] Title

Thank you

Thanks for sharing :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.