I am trying to change the color of the form labels and I was wondering how to do it.
<div class="form-group">
<div class="medium-6 columns">
<?php
echo form_label('First Name');
$data = array(
'class'=>'form-control',
'name'=>'fname',
'placeholder'=>'First Name'
);
echo form_input($data);
?>
</div>
Use always form_helper way
$attributes = array(
'class' => 'class-name-yours', // external or internal css
'style' => 'color: #000;' // or inline css, this is black color
);
echo form_label('First Name', 'firstname', $attributes); //first name is form id
In your form open if you have a id="exmaple" In your css file have you tried
#example label {
color: #222222;
}
You may need important
#example label {
color: #222222 !important;
}
And looks like your mixing foundation code with bootstrap code bootstrap col-md-6
http://getbootstrap.com/css/#grid-options
I think best option is..
<div id="firstname" style="color: orange;">
<?php
echo form_label('First Name') ;
?>
</div>
Related
I'm using WordPress with ACF, and I need to use a value of custom fields for CSS. For example, if the value of ACF 'Name' is YES, then CSS style just background around that field, if the value of the field is NO, then the background will be red.
I think you can easily fix it by if condition. It has value then shows green color otherwise shows red color. you need to replace the CSS class name.
<?php
// Get field data
$data = get_field('wifi');
if( 'yes' == $data ){
?>
<style>
.entry-title{
color: green;
}
</style>
<?php
}else{
?>
<style>
.entry-title{
color: red;
}
</style>
<?php
}
?>
Field: https://prnt.sc/cWvtiZia1KCm
Green value: https://prnt.sc/ZO_4N_ob6J7h
Red value: https://prnt.sc/ApikklLCEhhz
I would do it via classes.
Supposing "WiFi" is a "True/False" custom field:
.no_wifi {
background-color: red;
}
.wifi {
background-color: green;
}
<?php
$class_to_add = 'no_wifi';
if (get_field('WiFi')) {
$class_to_add = "wifi";
}
?>
<div class="<?php echo $class_to_add; ?>">
...
</div>
I want to create a small swiper slider that will rotate some logo images with a scrollable horizontal bar. I have already done something similar without problems, but now I'm facing a problem with the integration of the slider. The images I'm using have different sizes, but I want to give them a fixed width and height of 80px. I've tried to setup this value from the css but the settings will be ignored, images will be stretched to 1280px width and it will fade in between the images and I don't want this beahviour. I have more than one swiper instance on the same page, but I don't think that this can be a problem because I've setted another class for the slider who are giving me the problem.
Here is the code I'm using:
<?php
$args = array(
'post_type' => 'post',
'name' => 'partners'
);
$logo_img = new WP_Query( $args );
?>
<div class="container" id="">
<div class="row" style="margin-top:1em;margin-bottom:1em;">
<?php if( $logo_img->have_posts() ): while( $logo_img->have_posts() ): $logo_img->the_post();
$logo_gallery = get_post_gallery_images( $post->ID );
if( $logo_gallery ): ?>
<div class="swiper-container partners-slider" id="partners-slider">
<div class="swiper-wrapper" id="partners-logo-wrapper">
<?php foreach($logo_gallery as $logo ): ?>
<img class="swiper-slide partner-logo" src="<?php echo $logo; ?>" alt="" width="80" id="partner-logo"/>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="swiper-scrollbar"></div>
</div>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
</div>
<script type="text/javascript">
const swiperLogos = new Swiper('.partners-slider',{
autoplay: {
delay: 5000,
},
slidesPerView: 'auto',
slidesPerColumnFill: 'row',
scrollbar: {
el: '.swiper-scrollbar',
draggable: true,
},
});
</script>
</div>
CSS
#partners-slider{
height: 80px;
width: 100%;
background-color: transparent;
}
.partner-logo{
height: 80px;
width: 80px;
}
Try .swiper-slide img { width: 80px!important; height: 80px!important; }
I'm trying to hide the parent element in Wordpress if the child has no tags.
Đ¢his is the code:
<div id="tags">
<h4 class="tag-title">Tags</h4>
<?php the_tags( '', ' ', '<br />' ); ?>
</div>
I want to hide all div #tags if php string is empty.
You can use the function has_tag() to check if there is a tags.
<?php if(has_tag()) { ?>
<div id="tags">
<h4 class="tag-title">Tags</h4>
<?php the_tags( '', ' ', '<br />' ); ?>
</div>
<?php } ?>
If you use html elements as the $before, $sep, and $after parameters for the_tags, you can hide #tags when there's only one child (the ).
Looking at this post: Selector for when only one child exists in parent I came up with the below example.
<style>
.tags h4:nth-child(1):last-child{
display: none;
}
</style>
<div class='tags' id='tags1'>
<h4>Some nonsense</h4>
</div>
<div class='tags' id='tags2'>
<h4>Some nonsense</h4>
<ul><li>Some</li><li>other</li></ul>
</div>
I have this class for my menu: .site-header-menu
and I have this class for my content: .content
what should I do to catch .content when .site-header-menu is displayed?
I already tried this but it doesn't work:
.site-header-menu + .content{
opacity: 0;
}
Do you have some suggestion? This kind of things are possible using css?
I'm using Wordpress so this is my php struture in header.php. The idea is to hide the content of my page template when site-header-menu is open:
<?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
<!--<button id="menu-toggle" class="menu-toggle"><?php _e( 'Menu', 'twentysixteen' ); ?></button>-->
<button id="menu-toggle" class="menu-toggle" data-title="<?php the_title(); ?>"><?php the_title(); ?></button>
<div id="site-header-menu" class="site-header-menu">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>" data-title= ''>
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
How is .site-header-menu being displayed? Is a class being added to display the menu or is its display property being directly manipulated by JavaScript? There is no indication how you can tell if the menu is displayed?
.site-header-menu + .content{
opacity: 0;
}
The above rule, because of the plus sign, will only apply if the element with class content is immediately following the element with class site-header-menu in the DOM. For example:
<div class="site-header-menu">
... menu stuff ...
</div>
<div class="content">
... content stuff ...
</div>
This might be the problem, but without actually seeing the output HTML it's hard to say.
If you are using PHP or JS to toggle the visibility of the menu you could potentially add/remove an additional class to .content that will hide/show it based on the menu being displayed or not.
/* CSS rule to hide the .content element */
.content.hideMe {
visibility: none;
}
// pseudo-script click event handler (NOT REAL SCRIPT!)
function menuButtonClick() {
if (menuCurrentlyDisplayed) {
// menu is already displayed so hide it and show content
hideMenu;
removeClass(".content", "hideMe");
} else {
// menu is not yet displayed so show it and hide content
showMenu;
addClass(".content", "hideMe");
}
}
If you could post your output HTML, or set up a fiddle for us to take a look, it would be helpful.
I want to hide the site-title and site-description on IE9 and lower. I've hidden them via the appearance option, so its hidden on Chrome, Firefox, IE10+, but it still appear on IE9 and lower.
I've tried to add all this css, but I can not manage to make it work:
.site-description {
font-size: 10pt;
}
h2 .site-description {
font-size: 10pt;
display:none !important;
}
#title_subtitle{
display:none !important;
}
#site-title a, #site-description a {visibility:hidden !important;}
.site-title a, .site-description a {visibility:hidden !important;}
I've also tried to delete them in the header, but doesn't work:
the part of the header is:
<div id="masterheader"><header id="masthead" class="site-header" role="banner">
<a class="home-link"<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<div id="logo_and_title">
<img class="header-logo" src="http://thibaultrolando.com/vinacotheque/wp-content/uploads/2014/03/logo.png"/>
<div id="title_subtitle">
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>
I'm currently working with a child-theme of twenty-thirteen. I've tried to do this in the style.css and also ie.css from my child, and also the original theme, but it doesn't seem to work ...
If you want to hide them via php, you should be able to remove them from your theme's header.php file. Try commenting out the lines that generate the text. If that does the trick, you can delete them.
<div id="title_subtitle">
<!--
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
-->
</div>