Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter artisticmind

    (@artisticmind)

    Awesome. Thank you Justin, that worked and I can at least view the page to edit it. Ill contact the theme author to fix if possible. Oh I didn’t realize you were the developer behind the plugin. Great work man. Thank you

    • This reply was modified 4 years, 1 month ago by artisticmind.
    Thread Starter artisticmind

    (@artisticmind)

    Hm, I understand… is there anything I can do to give more information? I can post the code to that file here. I thought the CMB2 was a common plugin or something…

    Here is the file in questions code: I should be ok to post it no?

    <?php
    /**
     * CMB checkbox field type
     *
     * @since  2.2.2
     *
     * @category  WordPress_Plugin
     * @package   CMB2
     * @author    WebDevStudios
     * @license   GPL-2.0+
     * @link      https://webdevstudios.com
     */
    class CMB2_Type_Checkbox extends CMB2_Type_Text {
    
    	/**
    	 * If checkbox is checked
    	 *
    	 * @var mixed
    	 */
    	public $is_checked = null;
    
    	/**
    	 * Constructor
    	 *
    	 * @since 2.2.2
    	 *
    	 * @param CMB2_Types $types
    	 * @param array      $args
    	 */
    	public function __construct( CMB2_Types $types, $args = array(), $is_checked = null ) {
    		parent::__construct( $types, $args );
    		$this->is_checked = $is_checked;
    	}
    
    	public function render() {
    		$defaults = array(
    			'type'  => 'checkbox',
    			'class' => 'cmb2-option cmb2-list',
    			'value' => 'on',
    			'desc'  => '',
    		);
    
    		$meta_value = $this->field->escaped_value();
    
    		$is_checked = null === $this->is_checked
    			? ! empty( $meta_value )
    			: $this->is_checked;
    
    		if ( $is_checked ) {
    			$defaults['checked'] = 'checked';
    		}
    
    		$args = $this->parse_args( 'checkbox', $defaults );
    
    		return $this->rendered(
    			sprintf(
    				'%s <label for="%s">%s</label>',
    				parent::render( $args ),
    				$this->_id(),
    				$this->_desc()
    			)
    		);
    	}
    
    }
    

    it looks like maybe it has to do with this section? I just have no idea how to edit it…

    	public function __construct( CMB2_Types $types, $args = array(), $is_checked = null ) {
    		parent::__construct( $types, $args );
    		$this->is_checked = $is_checked;
    	}
    
    	public function render() {
    		$defaults = array(
    			'type'  => 'checkbox',
    			'class' => 'cmb2-option cmb2-list',
    			'value' => 'on',
    			'desc'  => '',
    		);
    • This reply was modified 4 years, 1 month ago by artisticmind. Reason: added more code
Viewing 2 replies - 1 through 2 (of 2 total)