Footer Widgets


Hello everyone,

I'm totally new with the beans framework and that's why i'm facing lots of difficulties so i'm keep asking for you help in order to educate myself. Hoping that this doesn't irritate you. πŸ™‚

I wanted to show a widget area above footer section, For that I wrote this :-

/*--- Register widget location*/
add_action( 'widgets_init', 'HI_widget_above_footer' );
function HI_widget_above_footer() {
 beans_register_widget_area( array(
    'name' => 'Above footer',
    'id' => 'above-footer-sec',
    'description' => 'Footer widgets Area',
    'beans_type' => 'grid'
 ) );
}

add_action( 'beans_footer_before_markup', 'HI_above_footer_widget' );
 function HI_above_footer_widget() {
 ?>

 <?php
}

This code registered the widget but it is not showing any widgets above footer, Please show help me to find the mistake.

Thanks.


Well, i've solved it,

If anyone else is looking for the solution, here is the code

//Register widget location

add_action( 'widgets_init', 'HyperIndian_widget_above_footer' );

function HyperIndian_widget_above_footer() {
 beans_register_widget_area( array(
    'name' => 'Above footer',
    'id' => 'above-footer',
    'description' => 'Footer widgets Area',
    'beans_type' => 'grid'
 ) );
}

//Footer widget in the front end
add_action( 'beans_footer_before_markup', 'HyperIndian_above_footer_widget_area' );

function HyperIndian_above_footer_widget_area() {
    echo beans_widget_area( 'above-footer' ); 
}

And if anybody wants to place that footer widget grid in the center with 1200px width than add this add atrtribute function

beans_add_attribute( 'beans_widget_area_grid[_above-footer]', 'class', 'uk-container uk-container-center');

Maybe, this will help someone. πŸ˜€



@anupam you are always welcom to ask questions, it is normal when a framework is new to you. I would advise to always search the documentation first as you could have found your answer in this article.


Yes Thierry i should have checked that.. Thank you for the reference.


Hi!

Did you noticed that the widgets in the footer widget area are not alligned with the rest of the widgets? If I do without the

beans_add_attribute( 'beans_widget_area_grid[_above-footer]', 'class', 'uk-container uk-container-center');

Then the widgets go to the left of the sidebar widgets. If I use the instruction above, then the widgets go a bit to the right of the sidebar widgets, meaning they never really align with the sidebar widgets...

Is there any option to make them align with the sidebar?

By the way: I also inserted your hero widget area, and the hero widget area aligns perfectly with the sidebar below it.

Thanks in advance for helping.


Hey Sami,

You can not add uk-grid and uk-container uk-container-center on the same HTML element. If you want to have your widgets centered, then you would add a div around your widget area as such:

add_action( 'beans_footer_before_markup', 'example_footer_widget_area' );

function example_footer_widget_area() {

  ?>
    <div class="uk-container uk-container-center">
      <?php echo beans_widget_area( 'example_footer_id' ); ?>
    </div>
    <?php

}

Once that done, don't forget to remove the line you previously had to add uk-container uk-container-center to beans_widget_area_grid[_above-footer] which is incorrect.

Have fun,

Write a reply

Login or register to write a reply, it's free!