Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Resolved] Choosing different widths for each widget area with Code Snippets

Home Forums Support Choosing different widths for each widget area with Code Snippets

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #318712
    Gustavo

    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!!

    #318728
    Tom
    Lead Developer
    Lead Developer

    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 🙂

    #318738
    Gustavo

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

    #318752
    Tom
    Lead Developer
    Lead Developer

    That’s right, click the “Save and activate” button 🙂

    #318832
    Gustavo

    Tanks you, Tom!!:)

    #318906
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.