Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
abayomiabayomi
@abayomiabayomi
Hello all
how can I sum 2 meta_value(s) to get a result list for a column in my post list?
i do not want to display the meta values in 2 separate columns, i want the two values(numbers) summed up for one single column
Sebastillar
@sebastillar_twitter

Hi everybody. I've already implements this code:
function cmb2_post_search_ajax_metaboxes_example() {

$example_meta = new_cmb2_box( array(
'id' => 'cmb2_post_search_ajax_field',
'title' => __( 'Related Posts', 'cmb2' ),
'object_types' => array( 'movie' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
) );

$example_meta->add_field( array(
'name' => ( 'Example Multiple', 'cmb2' ),
'id' => 'cmb2_post_search_ajax_demo_multiple',
'type' => 'post_search_ajax',
'desc' =>
( '(Start typing post title)', 'cmb2' ),
// Optional :
'limit' => 10, // Limit selection to X items only (default 1)
'sortable' => true, // Allow selected items to be sortable (default false)
'query_args' => array(
'post_type' => array( 'movie' ),
'post_status' => array( 'publish' ),
'posts_per_page' => -1
)
) );

$example_meta->add_field( array(
'name' => ( 'Example Single', 'cmb2' ),
'id' => 'cmb2_post_search_ajax_demo_single',
'type' => 'post_search_ajax',
'desc' =>
( '(Start typing post title)', 'cmb2' ),
// Optional :
'limit' => 1, // Limit selection to X items only (default 1)
'sortable' => false, // Allow selected items to be sortable (default false)
'query_args' => array(
'post_type' => array( 'movie' ),
'post_status' => array( 'publish' ),
'posts_per_page' => -1
)
) );

}
add_action( 'cmb2_init', 'cmb2_post_search_ajax_metaboxes_example' );

But WordPress admin doesn't render the input fields
somebody with same issue?
Sebastillar
@sebastillar_twitter
I resolve this issue!
For work with cmb2 ajax, required this plugin https://github.com/alexis-magina/cmb2-field-post-search-ajax
Sebastillar
@sebastillar_twitter
Oh, this plugin doesn't work in group fields :(
Please, any solution or suggestion?
Raymacz
@raymacz_twitter
Hi! just used CMB2 today, I have been reading the documentation but couldn't find the topic I'm searching for. Can anyone point the link on how to hide on screen - Box Support (similar to ACF)? thanks,
like this ->> https://www.screencast.com/t/6lsOzz9nGOF
microcol
@microcol
hi
i want to add custom filed for Relationships between 2 post
Jeremy Turowetz
@jerturowetz
Hi @microcol, this seems like something covered by the docs & 3rd party resources. Can you check there please https://cmb2.io/#cmb2-3rd-party-resources
@raymacz_twitter I am pretty sure there is no point and click for engaging with cmb2. When you add new meta boxes you explicitly define where you want them to appear (in the code).
[*correct me if I'm wrong obvs]
andrew-ok7
@andrew-ok7
I am using an image field in an options page, but in the dashboard, after saving the image, the thumbnail does not show, I have narrowed down the issue to the image not being displayed using https, once I ad the "s" using inspector, the image thumbnail loads fine in the dashboard, anyway to force cmb2 to use https to display thumbnails in the dashboard for the image field or to have it load as a relative path?
Develon674
@Develon674
Hi, can anybody give me pointers on how to include cmb2 in a plugin via composer. I have required it through composer but I'm not sure how to include it. Thanks.
Chris Reynolds
@jazzsequence
Hi @Develon674 -- I just did this yesterday so I can speak to it a bit. As far as including it, I just added a require_once to init.php
lemme throw up a Gist and I can show you how I configured it
Develon674
@Develon674
Hey Chris, I actually went about it differently in the end. I added the cmb2 folder in the "vendor" directory to the classlist in the composer.json and then ran "composer dump-autoload". This then allows me to use the different classes with namespacing, which is great for me as I use dependency injection. To initalize CMB2, I just call on the bootstrap class (init.php) and then use the initalize public method. Thanks for the gist as it gave me a good starting point!
*initiate
Chris Reynolds
@jazzsequence
Glad it was helpful :)
karthikeyankasinathan
@karthikeyankasinathan
Hi! This WP Film Studio plugin movie category posts are not displaying
karthikeyankasinathan
@karthikeyankasinathan
I have created post using this plugin(WP Film Studio). In this plugin comes with elementor add on widget. There i have selected this widget option and then i chooses the movie category . After saving my editing it does not shows the posts.
andrew-ok7
@andrew-ok7
hello, I am trying to allow a user with editor role to access the options page in the dashboard, any suggestions?
Rich Deane
@QTRichieRich
@andrew-ok7
Carlos Herrera
@cehojac
Hi
Mike Ellis
@m1ke_ellis_twitter
Hi - can someone point me to how best to use CMB2 within a plugin settings page?
It's all installed and working ok, but if I have a settings page within my plugin, what's best way of showing CMB2 fields?
Chris Reynolds
@jazzsequence
Hey @m1ke_ellis_twitter I recently was looking at this, too. There are docs for creating your own settings page with CMB2, which is the easiest, but I couldn't figure out a good way to use CMB2 fields in existing settings pages or sections because of when CMB2 is loaded vs. when other parts of admin menu pages are loaded. It's possible that @jtsternberg knows of a specific way to hook CMB2 fields in an existing page but the fastest/easiest option is to roll your own. https://github.com/CMB2/CMB2-Snippet-Library/blob/master/options-and-settings-pages/options-pages-with-submenus.php
Mike Ellis
@m1ke_ellis_twitter
@jazzsequence thanks! I got it working but am saving the metadata into a random post - probably a terrible idea but I went with a super-high ID and it's only for a prototype anyway so hopefully should be ok!
Justin Sternberg
@jtsternberg
@m1ke_ellis_twitter post your code somewhere and we can potentially review. Preferably a gust or something with a bit more context.
Justin Sternberg
@jtsternberg
errr.. gist.
xyweb
@xyweb
hey I'm beginner, I use options-pages-with-tabs-and-submenus.php but I don't know how to show my options in my template. "myprefix_get_option( 'field Id' )." dose not work for me
Daniel Sarria
@danielcsarria
Is this chat still active?
iBudsLK
@iBudsLK
Hi
I just wanna activate the google map for my testing server
I have already created API key from google
and added to the field in the cmb2
but it still shows the developer watermark and it won't save the address
can somebody help on this please
Justin Sternberg
@jtsternberg
CMB2 doesn’t have a map field, so you’ll have to ask the author of the plugin.
AsafAzoulay
@AsafAzoulay
Hi, it is possible to add group of group fields?
AsafAzoulay
@AsafAzoulay
Do you have full example of how to do custom fields inside a group field + repeatable + save data correctly?
Justin Sternberg
@jtsternberg
AsafAzoulay
@AsafAzoulay
ok , thanks... i will try it
md.mortuj alam
@mdmortujalam_twitter
hi