I am fairly new to wordpress and I am using custom meta boxes. I really like the cmb2 plugin to help with creating custom meta boxes but I am wondering how to layout the fields in my meta boxes since I don't want them to be put in a straight list.
Since the generated output has lots of css classes attached I reckon that I am supposed to override the css as my needs dictate. That would be fine if I knew where to put my css. I don't suppose I should edit cmb2.css directly.
Can someone please explain to me what is the preferred way to add my css so that it is picked up in my custom meta boxes?
Regards,
Dirk.
WordPress
Last Comment
dirkil2
8/22/2022 - Mon
Alicia St Rose
Hi Dirk,
Can you provide a link to the plugin you are using?
dirkil2
ASKER
Sure, I can. I must have forgotten this in the first place.
Perfect! Is there also a way how to link in a css file instead of single css lines? The problem is where to put that css file and how to get the path correct in the <link> statement.
The plugin's css is already added to the head when the plugin is activated. If you want to override the styles you'll need to add styles in the head with the code as demonstrated in my answer.
Otherwise, you will have to dequeue the plugin styles and enqueue your own stylesheet. You will conditionally target the admin with "if(is_admin)".
Can you provide a link to the plugin you are using?