Angelo Rocha
Forum Replies Created
-
Forum: Plugins
In reply to: [CMB2] Repeatable Field Text – New line button labelWorks fine, thanks Michael.
Forum: Plugins
In reply to: Send post for another wordpress siteI create a function called: remote_post
and add a hook:add_action('publish_news','remote_post', 10, 2);
In function scope i get the current post data:
$post_title = $_POST['post_title']; $post_content = $_POST['content']; ...
But i don’t know how to send this data to another wordpress site.
I’m not using multisite, but the two sites are on the same network.
Any idea?Forum: Plugins
In reply to: [CMB2] Repeatable Field Text – New line button labelNo.
This code change the upload button text in a file field.
I want change the text in button of “add row” in a repeatable field, see: https://angelorocha.com.br/wp-content/uploads/2015/06/cmb-repeatable-field.pngForum: Plugins
In reply to: [CMB2] Repeatable Field Text – New line button labelHi Michael, example:
Code:
$actions->add_group_field($actionGroup, array( 'name' => 'Repeatable Text', 'id' => $prefix . 'mytext', 'type' => 'text', 'repeatable' => true, 'attributes' => array( 'placeholder' => 'Do Something', ), ));
Result:
Forum: Plugins
In reply to: [CMB2] Date field get only month and yearMichael, when you defines ‘date_formate’ as ‘m-Y’ and saved the post, the data disappear, but are stored in the database, becoming invisible just in the administration.
How to fix it?
Forum: Plugins
In reply to: [CMB2] Date field get only month and yearI’m using this solution for adjust the date in my plugin, but is possible use this only the specific metabox?
I try:
function omni_month_year( $data ) { $data['defaults']['date_picker']['dateFormat'] = 'mm-yy'; return $data; }
And:
$mydatemeta->add_field(array( 'name' => 'Month/Year', 'desc' => '<br>Select documment data.', 'id' => $prefix . 'documement_data', 'type' => 'text_date', 'default' => current_time('m-Y'), 'date_format' => omni_month_year(), ));
But no success.
Forum: Plugins
In reply to: [CMB2] Date field get only month and yearI set my date field with default “m-Y”, see:
$mydatemeta->add_field(array( 'name' => 'Month/Year', 'desc' => '<br>Select documment data.', 'id' => $prefix . 'documement_data', 'type' => 'text_date', 'default' => current_time('m-Y'), 'date_format' => __('m-Y', 'omni'), ));
But when i select a date, day/month/year, in database is saved dd/mm/yy. I want save only mm/yy.
Forum: Plugins
In reply to: [CMB2] CMB2 Group Fields – Number RowsUpdated to new version.
Thanks.Forum: Plugins
In reply to: [CMB2] CMB2 Group Fields – Number RowsSolved.
Forum: Hacks
In reply to: Custom Post TypeOk. Thanks.
I would like see this feature in the future WordPress. Attach post types in a settings page would solve everything.Forum: Hacks
In reply to: Custom Post TypeI need create an area where i can group post types.
Ex .: Cars.
In this area i want post types specifics to:
Brand
Manufacturer
Data Owner
EtcCreate a single post type and custom taxonomies can be a solution, but in this case i wonder if with wordpress could create a “post type group”.
Basically.Forum: Hacks
In reply to: Custom Post TypeNo. I want organize posttypes in admin page
Forum: Hacks
In reply to: Custom Post TypeHi gicolek.
Unfortunately it does not help me. Really i needed only to group certain post types. To give the idea to the user that it would be a single section.Forum: Plugins
In reply to: [CMB2] Default value 'none' for taxonomy_select and taxonomy_multicheck$terms return a array error:
{ ["errors"]=> array(1) { ["invalid_taxonomy"]=> array(1)
I test a different way:
function omni_get_areas_terms( $tax_args ) { $args = wp_parse_args($tax_args, array( 'hide_empty' => false )); $areaterms = get_terms('areas', $args); $term_options = array(); if ($areaterms) { foreach ($areaterms as $terms) { $term_options[$terms->term_id] = $terms->name; } } return $term_options; }
Works fine, but when choose the taxonomy get the message required field to publish post.
I set:
'show_option_none' => false,
And:
'attributes' => array( 'required' => 'required' ),
The message appears at the top of the wordpress panel.
See: https://goo.gl/bBt5ejForum: Plugins
In reply to: [CMB2] Default value 'none' for taxonomy_select and taxonomy_multicheckSame question.
I’m trying create a select with custom terms without a default none value. I see this tutorial, but got an empty array, my taxonomy is called “areas”, see my code:function omni_get_areas_terms( $taxonomy = 'areas', $args = array() ) { $args['taxonomy'] = $taxonomy; $args = wp_parse_args( $args, array( 'taxonomy' => 'areas' ) ); $taxonomy = $args['taxonomy']; $terms = (array) get_terms( $taxonomy, $args ); $term_options = array(); if ( ( $terms ) ) { foreach ( $terms as $term ) { $term_options[ $term->term_id ] = $term->name; } } return $term_options; }
Metabox code:
$area->add_field(array( 'name' => 'Area', 'desc' => 'Selecione a área de publica??o.', 'id' => $prefix . 'area_select', 'type' => 'select', 'show_option_none' => false, 'attributes' => array( 'required' => 'required' ), 'options' => omni_get_areas_terms(), ));
Where am i going wrong?
Debug:
Notice: Trying to get property of non-object in ../metaboxes/area-metabox.php on line 51
Line 51: $term_options[ $term->term_id ] = $term->name;