• mlyczko

    (@mlyczko)


    Hi

    I have theme and OptionTree is included in theme. I have directory “option-tree” in theme directory. In my theme’s functions.php i have:

    // Option Tree - BEGIN
    /**
     * Required: set 'ot_theme_mode' filter to true.
     */
    add_filter( 'ot_theme_mode', '__return_true' );
    
    /**
     * Required: include OptionTree.
     */
    require( trailingslashit( get_stylesheet_directory() ) . 'option-tree/ot-loader.php' );
    
    /**
     * OptionTree in Theme Mode
     */
    # require( trailingslashit( get_stylesheet_directory() ) . 'option-tree/ot-loader.php' );
    
    /**
     * Theme Options
     */
    require( trailingslashit( get_stylesheet_directory() ) . 'inc/theme-options.php' );
    
    /**
     * Meta Boxes
     */
    require( trailingslashit( get_stylesheet_directory() ) . 'inc/meta-boxes.php' );
    
    /**
     * Theme Customizer
     */
    require( trailingslashit( get_stylesheet_directory() ) . 'inc/customizer.php' );
    
    /**
     * Demo Functions (for demonstration purposes only!)
     */
    require( trailingslashit( get_stylesheet_directory() ) . 'inc/functions.php' );
    // Option Tree - END

    I’ve created child theme but with functions.php:
    add_filter( 'ot_child_theme_mode', '__return_true' );
    i have in child theme directory directories: “option-tree” and “inc” (the same files like in parent theme)

    My problem is when i want to change color in parent theme like that: http://screencast.com/t/2Coi3Ity5 this color is changing in child theme too.
    When i change color in child theme it’s also changing in parent theme.

    What am i doing wrong?

    Best Regards
    ML

    https://ww.wp.xz.cn/plugins/option-tree/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    That’s because you have not filtered and changed the option ID, settings ID and layout ID.

    Thread Starter mlyczko

    (@mlyczko)

    Should i add theme-options.php with different IDs to theme-child? Could you please give me an example?

    Best Regards
    ML

    Thread Starter mlyczko

    (@mlyczko)

    Is there any option to have more than one child theme?

    It’s working fine for me when i have only one child theme.

    I’ve created child theme but with functions.php:
    add_filter( 'ot_child_theme_mode', '__return_true' );

    In parent theme i have in /inc/theme-options.php:

    array(
            'id'          => 'main_scheme_color',
            'label'       => __( 'Choose the main scheme color instead of using the default green one. Many general theme elements will be modified like buttons, links, pagination. Another elements like titles can be configured separately.', 'pe-cooking-blog' ),
            'desc'        => __( 'Color for buttons, links, pagination etc.', 'pe-cooking-blog' ),
            'std'         => '#68aa10',
            'type'        => 'colorpicker',
            'section'     => 'background_colors',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'min_max_step'=> '',
            'class'       => '',
            'condition'   => '',
            'operator'    => 'and'
          ),

    In child theme i have in /inc/theme-options.php:

    array(
            'id'          => 'main_scheme_color_color1',
            'label'       => __( 'Choose the main scheme color instead of using the default green one. Many general theme elements will be modified like buttons, links, pagination. Another elements like titles can be configured separately.', 'pe-cooking-blog' ),
            'desc'        => __( 'Color for buttons, links, pagination etc.', 'pe-cooking-blog' ),
            'std'         => '#68aa10',
            'type'        => 'colorpicker',
            'section'     => 'background_colors',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'min_max_step'=> '',
            'class'       => '',
            'condition'   => '',
            'operator'    => 'and'
          ),

    Till this time it’s ok, but when i create second child theme there is a problem. In second child theme i have in /inc/theme-options.php:

    array(
            'id'          => 'main_scheme_color_color2',
            'label'       => __( 'Choose the main scheme color instead of using the default green one. Many general theme elements will be modified like buttons, links, pagination. Another elements like titles can be configured separately.', 'pe-cooking-blog' ),
            'desc'        => __( 'Color for buttons, links, pagination etc.', 'pe-cooking-blog' ),
            'std'         => '#68aa10',
            'type'        => 'colorpicker',
            'section'     => 'background_colors',
            'rows'        => '',
            'post_type'   => '',
            'taxonomy'    => '',
            'min_max_step'=> '',
            'class'       => '',
            'condition'   => '',
            'operator'    => 'and'
          ),

    Now when i change color in first child theme, color in second child theme is reseted to default. When i set color in second child theme, color in first child theme is reseted.

    Please help.

    Best Regards
    ML

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Child Theme – big problem’ is closed to new replies.