Site logo

Archived topic

Choosing different widths for each widget area with Code Snippets

5 replies · Started by Gustavo on May 16, 2017

Viewing posts 1–6 of 6

Hello!
I would like to change the widths of the footer widgets in this way, is my code correct?:

add_filter('generate_footer_widget_1_width','tu_custom_footer_1_width');
function tu_custom_footer_1_width(){
    // Return the percentage of this widget width - 10% in this case
    return'10';
}

add_filter('generate_footer_widget_2_width','tu_custom_footer_2_width');
function tu_custom_footer_2_width(){
    // Return the percentage of this widget width - 20% in this case
    return'20';
}

add_filter('generate_footer_widget_3_width','tu_custom_footer_3_width');
function tu_custom_footer_3_width(){
    // Return the percentage of this widget width - 20% in this case
    return'20';
}

add_filter('generate_footer_widget_4_width','tu_custom_footer_4_width');
function tu_custom_footer_4_width(){
    // Return the percentage of this widget width - 20% in this case
    return'20';
}

add_filter('generate_footer_widget_5_width','tu_custom_footer_5_width');
function tu_custom_footer_5_width(){
    // Return the percentage of this widget width - 30% in this case
    return'30';
}

I've never added php code I've installed code snippets to do it.

Could you tell me how?
Thank you!!

Almost! You just didn't have the second parameter of add_filter() pointing to the correct functions.

I just update your code so it should be good to go :)

Thanks Tom!
So, should I just paste the code into the Code Snippets and save the changes, or should I do something else?

That's right, click the "Save and activate" button :)

Tanks you, Tom!!:)

You're welcome :)

This archived topic is closed to new replies.