using after_row callback function
-
Hello and thanks a lot for your absolutely great plugin!
I’m working on a project and I need to create some condition after some rows and I have no idea how to use callback function for that purpose. as you explain in the wiki:
“before, after, before_row, after_row, before_field, after_field: These allow you to add arbitrary text/markup at different points in the field markup. These also accept a callback. The callback will receive $field_args as the first argument, and the CMB2_Field $field object as the second argument. “How can I use these callback functions? I mean what are the arguments? Without passing any arguments I can achieve what I want. here is an example:
$cmb->add_field( array( 'name' => __( 'test', 'testdomain' ), 'id' => $prefix . 'test', 'type' => 'text_medium', 'on_front' => true, 'after_row' => test_callback_function(125), ) );and here is my callback function:
function test_callback_function($another_test_var) { $test_var = 123; if($another_test_var > $test_var) { echo "Great!"; } }problem with this code is that the text “Great!” is shown on the top of the page and not after the current row!
The topic ‘using after_row callback function’ is closed to new replies.