forked from lino/radar-wp
WIP suggested fields, additional theming, cron, shortcodes.
This commit is contained in:
parent
98872a46bc
commit
a6f657092d
5 changed files with 284 additions and 115 deletions
|
@ -29,11 +29,10 @@ class Squat_Radar_Instance {
|
|||
include SQUAT_RADAR_DIR . 'includes/squat-radar-connector.php';
|
||||
include SQUAT_RADAR_DIR . 'includes/squat-radar-formatter.php';
|
||||
|
||||
add_shortcode( 'squat_radar_sidebar', array($this, 'print_sidebar') );
|
||||
// add_shortcode( 'squat_radar_widget', array( $this, 'shortcode' ) );
|
||||
add_action( 'plugins_loaded', array( $this, 'i18n' ), 5 );
|
||||
add_action( 'widgets_init', array( $this, 'add_sidebar' ), 20 );
|
||||
add_action( 'widgets_init', array('Squat_Radar_Widget', 'register_widget') );
|
||||
add_shortcode( 'squat_radar_sidebar', [$this, 'print_sidebar'] );
|
||||
add_action( 'plugins_loaded', [$this, 'i18n'], 5 );
|
||||
add_action( 'widgets_init', [ $this, 'add_sidebar'], 20 );
|
||||
add_action( 'widgets_init', ['Squat_Radar_Widget', 'register_widget'] );
|
||||
|
||||
Squat_Radar_Formatter::register();
|
||||
}
|
||||
|
@ -47,25 +46,11 @@ class Squat_Radar_Instance {
|
|||
load_plugin_textdomain( 'squat-radar', false, '/languages' );
|
||||
}
|
||||
|
||||
/**
|
||||
* output a widget using 'widget' shortcode.
|
||||
*
|
||||
* Requires the widget ID.
|
||||
* You can overwrite widget args: before_widget, before_title, after_title, after_widget
|
||||
*
|
||||
* @example [widget id="text-1"]
|
||||
* @since 0.1
|
||||
*/
|
||||
public function shortcode( $atts, $content = null ) {
|
||||
$atts['echo'] = false;
|
||||
return $this->do_widget( $atts );
|
||||
}
|
||||
|
||||
function print_sidebar() {
|
||||
ob_start();
|
||||
|
||||
if (is_active_sidebar('squat_widget_gebied')) {
|
||||
dynamic_sidebar('squat_widget_gebied');
|
||||
if (is_active_sidebar('squat_radar_widget_shortcode')) {
|
||||
dynamic_sidebar('squat_radar_widget_shortcode');
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
|
@ -75,15 +60,15 @@ class Squat_Radar_Instance {
|
|||
|
||||
function add_sidebar() {
|
||||
|
||||
register_sidebar(array(
|
||||
register_sidebar([
|
||||
'name' => __( 'Squat Radar Shortcodes'),
|
||||
'description'=> __( 'This widget area is not by default displayed on frontend. It can be displayed with all its widgets with the [squat_radar] shortcode.', 'squat-radar' ),
|
||||
'description'=> __( 'This widget area is not by default displayed on frontend. It can be displayed with all its widgets with the [squat_radar] shortcode; or used to hold active widgets displayed with their own [squat_radar_widget id="X"] shortcode, see instructions on widget configuration for the id.', 'squat-radar' ),
|
||||
'id' => 'squat_radar_widget_shortcode',
|
||||
'before_widget' => '<div class="widget %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
'before_title' => '<h3 class="widget-title">',
|
||||
'after_title' => '</h3>',
|
||||
));
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue