: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/***************************************************************************
* ----------------------------------------------------------------------
* ----------------------------------------------------------------------
* ----------------------------------------------------------------------
***************************************************************************/
defined( 'ABSPATH' ) || exit;
///////////////////////////////////////////
///////////////////////////////////////////
class Themify_Layout_Part extends WP_Widget {
///////////////////////////////////////////
///////////////////////////////////////////
$widget_ops = array( 'classname' => 'layout-parts', 'description' => __('Layout Parts widget', 'themify') );
/* Widget control settings. */
$control_ops = array( 'id_base' => 'themify-layout-parts' );
parent::__construct( 'themify-layout-parts', __('Themify - Layout Parts', 'themify'), $widget_ops, $control_ops );
///////////////////////////////////////////
///////////////////////////////////////////
function widget( $args, $instance ) {
/* User-selected settings. */
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$layout_part = isset( $instance['layout_part'] ) ? $instance['layout_part'] : false;
/* Before widget (defined by themes). */
echo $args['before_widget'];
echo $args['before_title'] , $title , $args['after_title'];
echo do_shortcode('[themify_layout_part slug=' . $layout_part . ']'),$args['after_widget'];
///////////////////////////////////////////
///////////////////////////////////////////
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = $new_instance['title'];
$instance['layout_part'] = $new_instance['layout_part'];
///////////////////////////////////////////
///////////////////////////////////////////
function form( $instance ) {
/* Set up some default widget settings. */
$instance = wp_parse_args( (array) $instance, array(
$field = esc_attr($this->get_field_id( 'layout_part' ));
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'themify'); ?></label><br />
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" type="text" />
<label for="<?php echo $field; ?>"><?php _e('Layout Part:', 'themify'); ?></label>
<select id="<?php echo $field; ?>" name="<?php esc_attr_e( $this->get_field_name( 'layout_part' ) ); ?>">
$layouts = get_posts( array(
'post_type'=>Themify_Builder_Layouts::LAYOUT_PART_SLUG,
'post_status' => 'publish',
'orderby' => 'post_title',
'ignore_sticky_posts'=>true,
'update_post_term_cache'=>false,
'update_post_meta_cache'=>false,
foreach( $layouts as $layout ) {
echo '<option value="' . $layout->post_name . '"';
if ( $layout->post_name === $instance['layout_part'] ) echo ' selected="selected"';
echo '>' , esc_html( $layout->post_title ),'</option>';
register_widget( 'Themify_Layout_Part' );