Monday, January 30, 2023
HomeWordPress Developmentfeatures - Swap Wordpress "Widget Space" primarily based on Web page Template

features – Swap WordPress “Widget Space” primarily based on Web page Template


i am utilizing 3 widget areas in my youngster theme’s footer.

i created a secondary customized theme efficiently, and am hoping i can merely change these 3 widget space’s out within the second theme.

Footer – Column 1” would change to “Alt Footer – Column 1
Footer – Column 2” would change to “Alt Footer – Column 2
Footer – Column 3” would change to “Alt Footer – Column 3

(and sure, i’ve already created in WP admin > Appearnace > Widgets, these 3 new customized widget areas, & put temp textual content widgets in them for now).

i am utilizing this in “features.php” to alter the “Menu“…

add_filter( 'wp_nav_menu_args', 'respect_menu_swap' );
operate respect_menu_swap( $args="" ) 
{
    if(is_page_template('template-respect.php') && $args['menu_id'] == 'avia-menu') 
    {
        $args['menu'] = '16';
    } 
    return $args;
}

…am hoping for one thing much like change every of these “widget areas”.

i’ve searched, learn, searched, & learn a LOT making an attempt to determine this out & simply can not seem to grasp what ought to go instead of the menu phrases in that code bit. i actually wrestle with PHP, so would significantly admire particular clarification & code:-)

and, i am saying “Widget Spaceas an alternative of “Widgets” as a result of i noticed that “Widgets” are INSIDE the “Widget Areas”. i might prefer to swap the entire space as an alternative of simply the widget so my folks can add/take away numerous widgets in these 3 “areas” within the WP > Look > Widgets admin web page as wanted. it’s my understanding that if i simply use the “Widget ID” then when somebody adjustments which widget(s) are in a type of widget areas, it received’t replace on the websites front-end with out me altering these ID’s first. i’d prefer to keep away from having to do this if potential.

(BTW: i am utilizing the Enfold WP theme, if that issues)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments