Giter Site home page Giter Site logo

pqina / snippy Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 6.0 351 KB

๐Ÿก Quickly create your own custom shortcodes

Home Page: https://wordpress.org/plugins/snippy/

PHP 86.00% JavaScript 8.57% CSS 5.43%
shortcode wordpress builder composer customer creator wordpress-plugin

snippy's Introduction

Snippy WordPress Shortcode Builder

Use Snippy to create custom shortcodes. Upload files and create HTML, CSS and JavaScript snippets which then can be combined in your own shortcode.

Download Snippy

How to setup a JavaScript Countdown plugin on WordPress using Snippy.

snippy's People

Contributors

arnons1 avatar inbetweencode avatar rikschennink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

snippy's Issues

Including admin JS results in Javascript errors on page/post edit screens

Admin JS file is better enqueued conditionally.

Solution below

snippy.php, line 213:

public function register_admin_scripts($hook) {

    if( 'snippy_page_snippy_edit_bit' != $hook && 'snippy_page_snippy_edit_shortcode' != $hook ) {
        return;
    }

    \wp_enqueue_style( 'snippy-admin-styles', \plugin_dir_url( __FILE__ ) . 'admin/css/style.css', array(), Snippy::$version );
    \wp_enqueue_script( 'snippy-admin-scripts', \plugin_dir_url( __FILE__ ) . 'admin/js/script.js', array(), Snippy::$version, true );

}

No placeholders results in PHP error

When using a bit without any attributes (ie: [my_shortcode]), it displays the following:

Warning: array_merge(): Argument #1 is not an array in /.../wp-content/plugins/snippy/snippy.php on line 304
Warning: array_merge(): Argument #1 is not an array in /.../wp-content/plugins/snippy/snippy.php on line 307

Per the shortcode documentation "$atts - an associative array of attributes, or an empty string if no attributes are given" ( Shortcode API ) hence it's wrong to consider that $atts will always be an array. Since attributes are optional (ie: [my_shortcode] ), atts can be a blank string.

Adding this on line 304 fixes the issue

if (!is_array($atts)) $atts = array();

above these sections.

This started only since the last update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.