on my site I'm using cenetric, a child theme of genesis and this theme comes with some predefined color schemes.
//* Add support for additional color style options
add_theme_support( 'genesis-style-selector', array(
'centric-pro-charcoal' => __( 'Centric Charcoal', 'centric' ),
'centric-pro-green' => __( 'Centric Green', 'centric' ),
'centric-pro-orange' => __( 'Centric Orange', 'centric' ),
'centric-pro-purple' => __( 'Centric Purple', 'centric' ),
'centric-pro-red' => __( 'Centric Red', 'centric' ),
'centric-pro-yellow' => __( 'Centric Yellow', 'centric' ),
) );
Now I am looking for a way to create a random color scheme, so that every time any user visit my site, the color scheme gets automatically selected. I've tried the following:
$thm_out = array("Charcoal", "Green", "Orange", "Purple", "Red", "Yellow");
//* Add support for additional color style options
add_theme_support( 'genesis-style-selector', array(
'centric-pro-charcoal' => __( 'Centric Charcoal', 'centric' ),
'centric-pro-green' => __( 'Centric Green', 'centric' ),
'centric-pro-orange' => __( 'Centric Orange', 'centric' ),
'centric-pro-purple' => __( 'Centric Purple', 'centric' ),
'centric-pro-red' => __( 'Centric Red', 'centric' ),
'centric-pro-yellow' => __( 'Centric Yellow', 'centric' ),
'centric-pro-random' => __( 'Centric '.$thm_out[array_rand($thm_out, 2)].'', 'centric' ),
) );
But its giving the following error in my admin panel and also not working properly.
Warning: Illegal offset type in C:\xampp\htdocs\dev\wp-content\themes\centric-pro\functions.php on line 69
So, can you guys please help me to fix this issue?
Aucun commentaire:
Enregistrer un commentaire