0

I want to add a link like the one that currently exists in the Menu Locations sections of the customizer that says "You can also place menus in widget areas with the Custom Menu widget." The "widget areas" text link automatically opens the Widget panel without refreshing the whole page. How can I duplicate that functionality for whatever section?

Here is a screenshot:

customizer link to widget area

2
  • can you show the image what you need exactly?
    – prosti
    Dec 10, 2016 at 8:47
  • Added a screenshot above. I want a link like that, to a different section but working the same way.
    – jetyet47
    Dec 10, 2016 at 14:24

1 Answer 1

1

The relevant line that generates that link in wp-includes\class-wp-customize-nav-menus.php is

$description .= '<p>' . sprintf( __( 'You can also place menus in <a href="%s">widget areas</a> with the &#8220;Custom Menu&#8221; widget.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>';

and the more relevant part of it javascript:wp.customize.panel( 'widgets' ).focus();" )

so it seems like the key for having this kind of functionality is to know the name of the panel... now for sections there is no explicit example in core but might be worth trying to use javascript:wp.customize.section( 'your section name' ).focus(); as the href of the link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.