Support ForumHow to add new color fields in the Theme Options – Support Forum https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/feed Sat, 21 Dec 2024 16:42:33 +0200 http://bbpress.org/?v=2.5.12-6148 en-US https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-292 <![CDATA[How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-292 Sun, 11 Aug 2013 13:38:05 +0000 Elvis Benkovic Hi,

How to add new color fields in the Theme Options?

As you see in the picture i already created the fields, but e.g. when i try to use the color code “color5” it doesn´t work.

Theme Color Options extended

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-295 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-295 Mon, 12 Aug 2013 10:51:10 +0000 IshYoBoy Hi there,

It’s not enough to only create the fields for the codes, but also to add CSS styles which would style all needed elements using the given color. When adding a “color1” to “color4” to a shortcode they are used as CSS classes and the styles are then loaded from the generated CSS styles file “main-options.css”.

If you wish to add more colors please check the file “wp-content\themes\minicorp\assets\wp\themes\default_colors.php” as this is the place where the dynamic CSS file is being generated on every “Theme Options” save. You have to add the new color and the styles for the given element. Make sure to style the background-color, text-color, hover-color and hover-text color.

It’s a loooot of work if you’d like to style all existing shortcodes to support the new colors.

Cheers

A 5 star rating is always a great motivation for us if you are happy with our theme or support!
Themeforest | MojoMarketplace | Creative Market

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-860 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-860 Mon, 07 Oct 2013 11:11:26 +0000 Smen Thanks for the info about the default_colors.php.

I can’t seem to find the right places to add the custom boxes as Elvis did above. Can you explain me where to change it so I can add multiple color boxes that work?

Thanks in advance

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-863 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-863 Mon, 07 Oct 2013 11:24:05 +0000 IshYoBoy Hi,

Those fields can be added if you edit the following file:
“wp-content\themes\minicorp\admin\functions\functions.options.php”

You can easily add them on line 758 by adding an array as all other fields are added.

E.g.:

Hope this helps.
Cheers!

A 5 star rating is always a great motivation for us if you are happy with our theme or support!
Themeforest | MojoMarketplace | Creative Market

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-866 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-866 Mon, 07 Oct 2013 13:55:01 +0000 Smen I still can’t get it to work. This is what I’ve done:

1. Added functions in function.options.php

From line 758
2. Added styles in default_colors.php
i. Added $c5 = ( isset( $newdata['color5'] ) && '' != $newdata['color5'] ) ? $newdata['color5'] : ISH_COLOR_5; [line 25]
ii. $c5_rgb = ishyoboy_hex2rgb($c5); [line 38]
iii. .color5 .colex:after { content: ".color5 = <?php echo $c5; ?> (purple)"; } [line 431]
This for four new color styles.
3. Added complete new styles for color5 (to 8) by copying all from color4 and replacing:
color4 with color5
$c4 with $c5

4. Changed functions.interface.php
i. Added if ('' == $ish_options['color5']){ $ish_options['color5'] = ISH_COLOR_5; } from line 267
5. Hard reload admin page [CTRL + F5], saved options. Refreshed page.

That did it, but then i figured out that all most styles are double and have to be adapted manually.

Isn’t there an easier option?

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-867 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-867 Mon, 07 Oct 2013 14:06:55 +0000 IshYoBoy Hi,

The steps you have done seem to be correct.

Unfortunately the styles are not generated automatically and the styles for each color will need to be added manually. You could create a for-cycle to generate the same styles for all your new colors.

Cheers

A 5 star rating is always a great motivation for us if you are happy with our theme or support!
Themeforest | MojoMarketplace | Creative Market

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-869 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-869 Mon, 07 Oct 2013 14:15:33 +0000 Smen THanks for the fast response.

Ok, what do you mean with a for-cycle? Can you give me a reference or example?

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-871 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-871 Mon, 07 Oct 2013 14:52:54 +0000 IshYoBoy Hey,

if you are sure you have previously created the variables $c5 to $c10 then you can generate the same styles for all 5 variables using a for-cycle (or also for loop)

https://php.net/manual/en/control-structures.for.php

E.g.:

Don’t forget that you’ll see the changes ONLY AFTER you re-save all settings.

Cheers.

P.S.: This might help you understand the code better: Dynamic variable names in PHP

A 5 star rating is always a great motivation for us if you are happy with our theme or support!
Themeforest | MojoMarketplace | Creative Market

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-873 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-873 Mon, 07 Oct 2013 14:59:37 +0000 Smen That sir, has just made my day.
Thanks

]]>
https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-883 <![CDATA[Reply To: How to add new color fields in the Theme Options]]> https://support.ishyoboy.com/forums/topic/how-to-add-new-color-fields-in-the-theme-options/#post-883 Mon, 07 Oct 2013 15:23:41 +0000 IshYoBoy Hey,

Great, glad we could help!

Cheers

A 5 star rating is always a great motivation for us if you are happy with our theme or support!
Themeforest | MojoMarketplace | Creative Market

]]>