php - How do I "move" this function over to my child theme so I can change some parameters?
Get the solution ↓↓↓This parent theme that I'm using is determining the overall color scheme of the site within its own functions.php file. I simple want to change some of the color codes used in that switch statement. How can I "move" this over to my child theme's functions.php file so I can edit these color codes? I've tried copying this entire function() over to my child theme, but it gives me an error because the function is already being called.
Here is the code from the parent functions.php file:
function wpjobboard_theme_color_scheme() {
$img_directory = get_template_directory_uri() . '/stylesheets/img/';
$color_scheme = get_theme_mod('wpjobboard_theme_color_scheme');
// default
if ('green' == $color_scheme) {
return;
}
switch ($color_scheme) {
case 'blue':
$normal_color = '#28475f';
$darken_color = '#59a7db';
$lighten_color = '#5eb2ea';
break;
case 'mint':
$normal_color = '#3abd8f';
$darken_color = '#38b78b';
$lighten_color = '#40ce9c';
break;
case 'red':
$normal_color = '#e74c3c';
$darken_color = '#e04a3a';
$lighten_color = '#f05748';
break;
default: return;
}
extract( apply_filters('jobeleon_color_scheme', compact( $normal_color, $darken_color ) ) );
// map tooltip setting is on job.php
echo '<style>';
echo "
.jobeleon-normal-color {
color: $normal_color;
}
.jobeleon-normal-bg, .noUi-connect {
background-color: $normal_color;
}
.jobeleon-normal-border {
border-color: $normal_color;
}
.jobeleon-darken-color {
color: $darken_color;
}
.jobeleon-darken-bg {
background-color: $darken_color;
}
.jobeleon-darken-border {
border-color: $darken_color;
}
::selection {
background: $normal_color;
}
::-moz-selection {
background: $normal_color;
}
a,
.widget li a:hover,
.wpjb-element-input-radio .wpjb-field,
.widget .recentcomments a,
.comment-list .edit-link a {
color: $normal_color;
}
.btn,
.widget input[type=\"submit\"],
body:after,
input[type=\"submit\"],
input[type=\"reset\"],
button,
.wpjb-button,
#wpjb-step .wpjb-current-step:before,
#wpjb-step .wpjb-begone-step:before,
.wpjb-filters .wpjb-sub-filters,
.wpjb-filters .wpjb-top-filter > a,
#wpjb-step:after,
.page-numbers a,
.comment-list .reply a,
#wpjb-paginate-links .page-numbers,
.customSelectInner:after,
.wpjb-new-btn:hover,
.wpjb-dropdown
{
background-color: $normal_color;
}
.btn:hover,
.widget input[type=\"submit\"]:hover,
input[type=\"submit\"]:hover,
input[type=\"reset\"]:hover,
button:hover,
.wpjb-button:hover,
.page-numbers a:hover,
.comment-list .reply a:hover,
#wpjb-paginate-links .page-numbers:hover
{
background-color: $darken_color;
}
.wpjb-element-input-radio .wpjb-field input:checked
{
border-color: $normal_color;
}
.wpjb-filters .wpjb-top-filter > a:after {
border-left-color: $normal_color;
}
.wpjb-box { background-color: $normal_color; }
.wpjb-box:hover { background-color: $darken_color; }
.wpjb .blue span { background-color: $normal_color; }
.wpjb .wpjb-motif { color: $normal_color; }
.wpjb .wpjb-motif-bg { background-color: $normal_color; }
.wpjb .wpjb-motif-border { border-color: $normal_color; }
.wpjb .wpjb-motif-border-top { border-top-color: $normal_color; }
.wpjb .wpjb-motif-border-right { border-right-color: $normal_color }
.wpjb .wpjb-motif-border-bottom { border-bottom-color: $normal_color; }
.wpjb .wpjb-motif-border-left { border-left-color: $normal_color; }
";
echo '</style>';
}
Answer
Solution:
It seems that you are using the "Jobeleon" theme if I am not mistaken.
In this case there is a filter you can use to add your own color theme.
This color scheme will then be accessible in your back office Appearance -> Customize panel.
In your child theme, just add a filter on 'jobeleon_color_scheme'.
add_filter('jobeleon_color_scheme', 'my_jobeleon_color_scheme');
function my_jobeleon_color_scheme($color) {
return array(
'normal_color' => 'orange',
'darken_color' => 'darkorange'
'lighten_color' => 'yellow'
);
}
You can change dark orange and yellow by the colors you want. This can be a text or hexadecimal colors.
Source: https://wpjobboard.net/blog/introducing-jobeleon/#comment-73860
Happy coding :)
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot access offset of type string on string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.