by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
fastmarketo
@fastmarketo
I have created this Option → $cmb->add_field( array(
'name' => 'Select Video or Image',
'desc' => 'Select an option',
'id' => $prefix . 'image_or_video',
'type' => 'select',
'show_option_none' => true,
'default' => 'custom',
'options' => array(
'standard' => ( 'Option One', 'cmb2' ),
'custom' =>
( 'Option Two', 'cmb2' ),
'none' => __( 'Option Three', 'cmb2' ),
),
) );
what i want is If Option two is selected is true then execute some php code
But how should In write this
Justin Sternberg
@jtsternberg
@fastmarketo I responded to your question on the support forum
fastmarketo
@fastmarketo
can you guide me wghere is thes upport forum?
*support
Justin Sternberg
@jtsternberg
fastmarketo
@fastmarketo
Yes sir, this is me. I got it sir. Thanks a lot sir.
Greg Pluta
@gpluta
Hello! I need a little help. I have registered a new cmb2 box. I set the 'show_on' option to key => 'page-template'. The custom box renders nicely in wp-admin. The problem is that the value set on one page is automatically set on all pages using this same template. Is there a way to make values set unique to each page using the same template?
Greg Pluta
@gpluta
Am I missing some option?
Greg Pluta
@gpluta
Oh okay I am sorry. Everything works fine now, I didn't realize that if I had a few instances of wp-admin opened, changes I made to one page were applied to other ones.
Justin Sternberg
@jtsternberg
Seems like you got it sorted, but CMB2 will save the data per page. It won't apply them to multiple pages.
Greg Pluta
@gpluta
@jtsternberg - yeah, all is fine now. Thanks anyway ;)
Jeremy Turowetz
@jerturowetz

Hello CMB2 gang.

It's been a while since I've included CMB2 on a project and, as I'm getting a new theme (not for distribution) set up, I'm wondering what the current best practice is?

I'm thinking it's one of the following:

  • Dump the github repo in my plugins folder
  • Use the official plugin from the WordPress plugins directory – issues re slower updates & this discussion?
  • Use the github repo as a dependency in the theme folder - assuming not?
  • Composer ?

I'm also curious if the best method is different depending on my purpose. Say, if I were building a plugin for redistribution, would I include CMB2 as a dependency in the project or just note that users need to install the official CMB2 plugin and leave it out?

Justin Sternberg
@jtsternberg
@jerturowetz if it's not for distribution, using the wp.org plugin is probably easiest/best.
if for distribution on .org, you can use: http://tgmpluginactivation.com/
if planning on selling, you can bundle it in your theme
b/c of how the CMB2 loader works, there isn't really a wrong way. They will all work. You can even do it all the ways, and it will still work, as it only loads one version of itself
the .org plugin is probably the best way to bundle it as it won't include a lot of the dev resources, like the github repo will contain
But composer is a perfectly acceptable way to do it as well.
"issues re slower updates & this discussion" well, the updates on github are not considered "released" so are subject to change. The .org release (or master branch) will contain the latest stable release version. And re: the discussion, that has settled down, and we are good to stay in the repo.
Jeremy Turowetz
@jerturowetz
Thanks for the detailed reply. You, and the rest of the teams attention to detail and quality of contribution to the open source community continues to really impress.
Justin Sternberg
@jtsternberg
Thank you sir.
Ian Barker
@iantbarker
If you read the previous issue that I mentioned, nevermind. I deleted it.
Elroy Fernandes
@hazephase
I want to have radio button options in which the user is able to add in values him/her self
alipixel
@alipixel
hi does cmb2 support nested group
Elroy Fernandes
@hazephase
is it possible to have a group in a group ?
K R Gowri Shankar
@shankartechnik
is it possible to resize images on file upload
Jeremy Turowetz
@jerturowetz
@hazephase to your first question about radio buttons: depending on your use case you might be able to achieve this by using a repeatable group
@shankartechnik I'm pretty sure the cmb2 file type uses the WordPress media uploader. This would mean that WordPress will resize images based on your configuration exactly as it would if you added files to the media library directly.
Elroy Fernandes
@hazephase
@jerturowetz thanks, I wanted to ask you can I have radio button options where the user fills them in ? or can I add variables to the options array ?
Jeremy Turowetz
@jerturowetz
That falls a bit outside the normal use case I'd think. Radio buttons are not natively meant to accept input (beyond "checked"). Dynamically building radio labels & keys to store them in the dB would require building custom functions and validation.
anilshah694
@anilshah694
Hello ,
how to integration CMB2 plugin with our theme folder please can you suggest me .
Jeremy Turowetz
@jerturowetz
@hazephase have you read the readme & the installation instructions ?
Justin Sternberg
@jtsternberg
The Basic Usage doc should have you covered for adding to your theme. https://github.com/CMB2/CMB2/wiki/Basic-Usage
SavvyTech
@nirob110
Hello, anyone there ?
I need a simple favor..
Jeremy Turowetz
@jerturowetz
What’s the question and I’ll see if I can help (just a community member :) )
ieotarohit
@ieotarohit
How to integrate CMB2 with Dokan plugin
?

@anilshah694 Follow the URL:-

https://github.com/CMB2/CMB2/wiki/Basic-Usage

Susant Paudel
@susantp
how to update CMB2 while it is not uploaded as plugins . I included CMB2 library in my theme.
Justin Sternberg
@jtsternberg
@susantp just download the plugin from http://wordpress.org/plugins/cmb2/, then replace the guts of your cmb2 folder with what is in the downloaded zip
Chris Reynolds
@jazzsequence
Or do the same from GitHub. But there's no way to automatically update CMB2, it's a manual thing.
Justin Sternberg
@jtsternberg
(when it's bundled)
Also, if you do it from github, you're going to get a lot of the developer artifacts... e.g. the tests directory, the sass files, etc. Things you won't need.
amit648
@amit648
first i created user metabox for using user post type.. So many field insert this metabox..So get only one fields on register page so how to get that fields and save data that user metabox.
amit648
@amit648
Please answer of my question and any one help or suggest for me..
Justin Sternberg
@jtsternberg
Sorry, it's not clear what you are asking
amit648
@amit648
Simply , i want to get one field of metabox in register form and that field save it that metabox .
Ian Barker
@iantbarker
Anyone know how I can retrieve a specific value from my repeatable field group? Essentially, how do I get a specific value from an array?