Plugin Directory

Changeset 2399576


Ignore:
Timestamp:
10/14/2020 03:20:46 PM (5 years ago)
Author:
kduffie
Message:

Content-grid widget and shortcode

Location:
slick-engagement/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • slick-engagement/trunk/SlickEngagement_Plugin.php

    r2379103 r2399576  
    114114        // add_shortcode('slick-next-up', array($this, 'doNextUpShortcode'));
    115115        add_shortcode('slick-story', array($this, 'doSlickStoryShortcode'));
     116        add_shortcode('slick-grid', array($this, 'doSlickGridShortcode'));
    116117
    117118// Register AJAX hooks
     
    148149    //     return '<div class="slick-widget slick-next-up slick-shortcode"></div>';
    149150    // }
     151
     152    public function doSlickGridShortcode($attrs, $content, $tag)
     153    {
     154        extract(shortcode_atts(array('id' => ''), $attrs));
     155        if (isset($id)) {
     156            return '<div class="slick-content-grid" data-config="' . trim($id) . '"></div>' . "\n";
     157        } else {
     158            return '<div class="slick-content-grid"></div>' . "\n";
     159        }
     160    }
    150161
    151162    public function doSlickStoryShortcode($attrs, $content, $tag)
     
    239250        global $post;
    240251        echo "\n";
    241         echo '<meta property="slick:wpversion" content="1.1.7" />' . "\n";
     252        echo '<meta property="slick:wpversion" content="1.1.8" />' . "\n";
    242253        $siteCode = trim($this->getOption('SiteCode'));
    243254        if ($siteCode) {
  • slick-engagement/trunk/SlickEngagement_Widgets.php

    r2284281 r2399576  
    109109}
    110110
     111class Slick_Grid_Widget extends WP_Widget
     112{
     113    /**
     114     * based on https://www.wpexplorer.com/create-widget-plugin-wordpress/
     115
     116     * The widget simply creates a container that the Slick script will populate
     117     * after the page loads with the Slick grid widget.
     118     */
     119
     120    public function __construct()
     121    {
     122        parent::__construct(
     123            'slick_grid_widget',
     124            __('Slick Grid Widget', 'text_domain'),
     125            array('customize_selective_refresh' => true)
     126        );
     127    }
     128
     129    public function form($instance)
     130    {
     131        $defaults = array(
     132            'title' => '',
     133            'id' => '',
     134        );
     135        extract(wp_parse_args((array) $instance, $defaults));
     136        ?>
     137    <?php // Widget Title ?>
     138    <p>
     139      <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Widget Title', 'text_domain');?></label>
     140      <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
     141    </p>
     142    <p>
     143      <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php _e('Slickstream ID', 'text_domain');?></label>
     144      <input class="widefat" id="<?php echo esc_attr($this->get_field_id('id')); ?>" name="<?php echo esc_attr($this->get_field_name('id')); ?>" type="text" value="<?php echo esc_attr($id); ?>" />
     145    </p>
     146    <?php
     147}
     148
     149    public function update($new_instance, $old_instance)
     150    {
     151        $instance = $old_instance;
     152        $instance['title'] = isset($new_instance['title']) ? wp_strip_all_tags($new_instance['title']) : '';
     153        $instance['id'] = isset($new_instance['id']) ? wp_strip_all_tags($new_instance['id']) : '';
     154        return $instance;
     155    }
     156
     157    public function widget($args, $instance)
     158    {
     159        extract($args);
     160        $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
     161        $id = $instance['id'];
     162        echo $before_widget;
     163        if ($title) {
     164            echo $before_title . $title . $after_title;
     165        }
     166        if (isset($id)) {
     167            echo '<div class="slick-content-grid" data-config="' . trim($id) . '"></div>' . "\n";
     168        } else {
     169            echo '<div class="slick-content-grid"></div>' . "\n";
     170        }
     171        echo $after_widget;
     172    }
     173}
     174
    111175function register_slick_widgets()
    112176{
    113177    register_widget('Slick_FilmStrip_Widget');
    114178    register_widget('Slick_Game_Widget');
     179    register_widget('Slick_Grid_Widget');
    115180}
    116181
  • slick-engagement/trunk/readme.txt

    r2379103 r2399576  
    77Requires at least: 4.0
    88Tested up to: 5.4.2
    9 Stable tag: 1.1.7
     9Stable tag: 1.1.8
    1010
    1111Increase pageviews and delight visitors with fast and responsive site search, beautiful content discovery tools and more.
     
    104104= 1.1.7
    105105- Revised shortcode for story-viewer
     106
     107= 1.1.8
     108- Added widget and shortcode support for content-grid widget
  • slick-engagement/trunk/slick-engagement.php

    r2379103 r2399576  
    33Plugin Name: Slickstream Search and Engagement
    44Plugin URI: https://slickstream.com/getting-started
    5 Version: 1.1.7
     5Version: 1.1.8
    66Author: Slickstream
    77Author URI: https://slickstream.com
Note: See TracChangeset for help on using the changeset viewer.