Show A Specific Tab When A Feature Image is Added

Support MB Conditional Logic Show A Specific Tab When A Feature Image is AddedResolved

Viewing 16 post (of 16 total)
  • Author
    Posts
  • #8284
    Anh TranAnh Tran
    Keymaster

    Hi Thomas,

    You can change from closure / anonymous function to this:

    add_filter( 'rwmb_outside_conditions', 'prefix_tab_conditions' );
    function prefix_tab_conditions( $conditions ) {
      $conditions['.rwmb-tab-totalpress_featured_image_options'] = array(
        'visible' => array('_thumbnail_id', '!=', '-1'),
      );
      $conditions['.rwmb-tab-panel-totalpress_featured_image_options'] = array(
        'visible' => array('_thumbnail_id', '!=', '-1'),
      );
      return $conditions;
    } );

    In short, just move the part function... down and add a name for it. Then alter the add_filter function and use the new function name.

    Read more about anonymous function here.

Viewing 16 post (of 16 total)
  • You must be logged in to reply to this topic.