Community Forums › Forums › Archived Forums › Design Tips and Tricks › removing genesis sections in wp customizer
Tagged: customizer, functions, hooks
- This topic has 3 replies, 2 voices, and was last updated 10 years, 9 months ago by
David Chu.
-
AuthorPosts
-
April 29, 2015 at 4:27 pm #149551
Earthling
MemberHi there,
I've been wanting to clear the WordPress customizer of some of the genesis sections, like genesis default layout picker etc. I want to make room for some customizer sections of my own. I've no problem removing the default WordPress sections like navigation using
$wp_customize->remove_section('nav');But using the same code to remove a genesis section, such as
$wp_customize->remove_section('genesis_comments');It doesn't kick in. Has anyone else run into this situation before and could advise me in any way. I'm hooking into 'customize_register' to run the above code so all should be well.
Thanks in advance,
John
http://localhostApril 30, 2015 at 9:32 am #149616David Chu
ParticipantJohn,
That's a very interesting question. I know that they quietly slipped a bunch of Genesis stuff into the Customizer, but I'd never dealt specifically with the Genesis Customizer stuff. I worked out a way to do this.add_action( 'customize_register', 'dc_pull_comments_from_customizer', 20 ); function dc_pull_comments_from_customizer ( $wp_customize ) { $wp_customize->remove_section('genesis_comments'); }It uses the standard WordPress function for hooking into the Customizer settings, and I put it into functions.php. I found another way, too, but this is the cleanest and avoids an extra global declaration. The "20" is key, too - the command didn't work without the priority, presumably due to timing of the Genesis Customizer commands. So if you get no results, try playing with that priority number, most likely using a higher one.
Cheers, Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
April 30, 2015 at 11:59 am #149640Earthling
MemberHello Dave,
Thanks for putting your head to this. I completely forgot about priority ... I knew Genesis was loading their settings after mine but didn't think to change priority. I saw that the genesis customizer function was being loaded into 'init' and just gave up after a while.
Thanks again, much appreciated.
April 30, 2015 at 1:05 pm #149650David Chu
ParticipantJohn,
Glad to hear it, you're welcome. Those priorities will getcha - and what's additionally confusing is that a priority that works with one theme will need to be boosted or shrunk on another, even with the same framework.I sort of had the opposite "insight" a few days ago... I'm working on a Genesis site, and tried one of the usual hooks, easy peasy, and just nothing, nada! Then it dawned on me that the site was pre-Genesis-2, so of course the Genesis 1 hooks worked just fine. 😉
Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
-
AuthorPosts
- The topic ‘removing genesis sections in wp customizer’ is closed to new replies.