• imads

    (@imads)


    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter imads

    (@imads)

    Any suggestion is highly appreciated…

    Thanks!

    Thread Starter imads

    (@imads)

    Any luck on finding some help here?

    Hi,

    I’m currently doing the following within a theme: Adding a post of type “tt_font_control” and the needed post meta “control_id”, “control_selectors”, “control_description” and “force_styles” whether the plugin is installed or not, so these controls are present and can be used after installing the plugin.

    Since the control IDs currently are generated randomly by the plugin between 1 and 100, I simply start with 101.

    Best,
    Marc

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Programatically create controls?’ is closed to new replies.