-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Query in CSS File is not closing when using several media_query controls #1787
Comments
I just tried this and I'm getting this CSS: @media (min-width: 1280px) {
#logo img {
width: 500px;
}
}
@media (max-width: 1279px) {
#logo img {
width: 400px;
}
}
@media (max-width: 767px) {
#logo img {
width: 300px;
}
} so that looks ok to me... Kirki::add_config( 'my_config', array(
'capability' => 'edit_theme_options',
'option_type' => 'theme_mod',
) );
Kirki::add_section( 'my_section', array(
'title' => esc_attr__( 'My Section', 'textdomain' ),
) );
Kirki::add_field( 'my_config', [
'settings' => 'logo_size_desktop',
'type' => 'slider',
'choices' => [
'min' => '50',
'max' => '500',
'step' => '1'
],
'default' => '500',
'output' => [
[
'element' => '#logo img',
'property' => 'width',
'units' =>'px',
'media_query' => '@media (min-width: 1280px)',
]
],
'section' => 'my_section',
] );
Kirki::add_field( 'my_config', [
'settings' => 'logo_size_tablet',
'type' => 'slider',
'choices' => [
'min' => '50',
'max' => '500',
'step' => '1'
],
'default' => '400',
'output' => [
[
'element' => '#logo img',
'property' => 'width',
'units' => 'px',
'media_query' => '@media (max-width: 1279px)',
]
],
'section' => 'my_section',
] );
Kirki::add_field( 'my_config', [
'settings' => 'logo_size_phone',
'type' => 'slider',
'choices' => [
'min' => '50',
'max' => '500',
'step' => '1'
],
'default' => '300',
'output' => [
[
'element' => '#logo img',
'property' => 'width',
'units' => 'px',
'media_query' => '@media (max-width: 767px)',
]
],
'section' => 'my_section',
] ); |
Hello Aristath, |
Hello Aristath, |
Sorry to say, but I need to reopen the issue. The problems appears ONLY when the output is saved in a CSS file. Please add the following filter to the code above
Then the code in the output CSS will look like this:
|
I believe I found the culprit... Haven't tested anything yet, didn't have time to test today, but looking at the code I think it's this part here: https://github.com/aristath/kirki/blob/v3.0.25/modules/css/class-kirki-css-to-file.php#L117-L124 |
Hello Aristath, |
Pushed this to the 3.0.26 version. |
THANK YOU VERY MUCH!! |
* develop: (73 commits) fixes #1730 fixes #1830 GDPR: Load webfont-loader locally Update fonts fixes #1834 Apply WordPress Coding Standards Update kirki-helper-class.md see #1797 cleanup unused vars See #1807 Additional fix for #1809 fixes #1828 fixes #1808 fix #1814 fix #1797 fixes #1809 Update sortable.md fixes #1787 update webfonts & grunt changelog ... # Conflicts: # modules/postmessage/class-kirki-modules-postmessage.php
Hi.
When I have only one media_query control in my sections it works just fine, but as soon there are more than one, than the following ones in the output CSS don't have a closing bracket.
This is my test setup:
This is the CSS output
The text was updated successfully, but these errors were encountered: