Programatically create controls?
-
Hi,
Your plugin is amazing! I want to use it with my theme to create demo controls when the theme is activated. I can create the controls but I’m not sure how exactly I can attach the properties to these controls.
So basically I’m doing:
$egf_post_handle = EGF_Posttype::get_instance(); $post_id = $egf_post_handle->update_font_control($ctrl_name, $ctrl_name, $ctrl_selectors, '', false);
What I see until now is:
– Controls are custom post types
– These custom post types contents are json econded options with main key being the control-id.So to programatically add the options for my custom controls should I just create a raw json array with the control-Id obtained after creation of the egf_control and then add that as post content?
$ctrl_id = get_post_meta($post_id, 'control-id'); // create json econded settings and set the custom post content to my json ecoded settings // eg: { "tt_font_theme_options[$ctrl_id]": { "value": { "text_transform": "lowercase", "font_id": "abhaya_libre", ... // update post content with above contents
Or is there some helper function that I can use to set a specific value like the text-transform for my control?
I’m asking because I’ve tried to edit the post content with phpmyadmi, changed a setting like “text_transform” from “lowercase” to “uppercase” and I’m not seeing it getting updated in the customizer.
- The topic ‘Programatically create controls?’ is closed to new replies.