File: /home/madepabj/gamepointpk.com/wp-content/plugins/groovy-functions/widgets/ads-fluid.php
<?php
$widget_id = 'epcl_ads_fluid';
$args = array(
'title' => esc_html_x('(EP) Fluid Ads', 'admin', 'groovy'),
'classname' => '',
'description' => esc_html_x('Display a fluid ads. Note: the max ads width is 300px and height is unlimited.', 'admin', 'groovy'),
'fields' => array(
array(
'id' => 'title',
'type' => 'text',
'title' => esc_html_x('Title:', 'admin', 'groovy'),
'default' => 'Advertising'
),
array(
'id' => 'width',
'type' => 'number',
'title' => esc_html_x('Width of advertise to show:', 'admin', 'groovy'),
'default' => 250,
'unit' => 'px'
),
array(
'id' => 'align',
'type' => 'button_set',
'inline' => true,
'title' => esc_html_x( 'Align:', 'admin', 'groovy'),
'options' => array(
'left' => esc_html_x('Left', 'admin', 'groovy'),
'center' => esc_html_x('Center', 'admin', 'groovy'),
'right' => esc_html_x('Right', 'admin', 'groovy'),
),
'default' => 'center'
),
array(
'id' => 'ads',
'type' => 'code_editor',
'title' => esc_html_x( 'Ads Code:', 'admin', 'groovy'),
'settings' => array(
'theme' => 'dracula',
'mode' => 'htmlmixed',
'tabSize' => 4,
// 'lineWrapping' => true
),
'sanitize' => false
),
)
);
function epcl_ads_fluid( $args, $instance ){
// WP 5.9 Patch: always disable widget preview in the backend
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
return false;
}
if( epcl_is_amp() ) return;
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if($title) echo $before_title.$title.$after_title;
if($instance['ads']){
echo '<div class="epcl-banner-wrapper">';
echo '<div class="epcl-banner align'.$instance['align'].'" style="max-width: '.$instance['width'].'px;">'.$instance['ads'].'</div>';
echo '</div>';
}
echo $after_widget;
}
$wp_widget_factory->register( EPCL_CreateWidget::instance( $widget_id, $args ) );