Coder Social home page Coder Social logo

ayecode / wp-super-duper Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 6.0 1.11 MB

A WordPress Class to build a widget,shortcode and Gutenberg block, from the creators of https://wpgeodirectory.com

Home Page: https://geodirectoryexperts.com

PHP 100.00%

wp-super-duper's People

Contributors

1naveengiri avatar justlevine avatar kprajapatii avatar mte90 avatar mutendebrian avatar picocodes avatar pol76 avatar stiofan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-super-duper's Issues

Hello World

in _my_extra_arguments

You have $options['block-output']['element::p']['content']

which fails with Notice: Undefined index: element::p in /var/www/html/.. /includes/vendor/ayecode/wp-super-duper/hello-world.php on line 131 ( add filter un commented ) (PHP 7.3 )

Now I'm not super advanced with PHP but I have never seen this syntax used in an array key element::p

I get what is trying to be done - i.e. update the content associated with the element type of p

But it seems to fail.

Code style

This project needs some code style as it is now it is very dramatic with mixed rules.

Divide into several files

This class is almost approaching 3000 lines of code. It might be time to finally divide it into several classes.

How-to questions and documentation

I've been lurking/following this class for a while and gave it a try today. Thanks for sharing! It's pretty straightforward and cool but I'm wondering if there is any official documentation that I missed? I've just been digging through the code and the examples.

My biggest concern is over a block preview in the editor. Is it not currently setup to have a preview? I'm wonder if thing widget_ops output argument can take a callback/function so we can return the actual block content in the editor as well?

Visibility Conditions for blocks

The idea is to add a new field to a block that will allow the user to select multiple condition for visibility, very much like our GD custom field conditions.

This will be a SD argument for anew field, it will display something like a button and current conditions below it. The button will open a modal where the conditions and be added or edited. The data will be stored in a JSON type array in a single field. Please look at how I did the blockstrap pluign gallery block.

  1. Only for blocks.
  2. Added by adding a field argument to a block, just change the "type" to something like "visibility_conditions".
  3. Clicking the button opens the modal when it will have a conditions builder almost exactly like our GD field conditions inputs, though we will add some more options like user role etc.
  4. Save as JSON type array, check how I did gallery images widget in blockstrap.
  5. Implement a function that can be implemented to check the conditions and not output.
  6. In the popup add and option for what should happen if condition met.
    1. No output.
    2. Show simple message, tex input and select if it should be a info/warning/danger notification.
    3. Show page content from ID
    4. Show a template part.

"Require login" blocks

Should support a 'require_login' argument that displays a UWP (if available) login form to logged out users. Otherwise, just show a "you are required to login to view this section". This will save us a lot of time when implementing blocks.

wp_add_inline_style/script was called incorrectly

Getting a bunch of notices that wp_add_inline_style and wp_add_inline_script are being called incorrectly from line 78.

Solved it by moving those to their own function, and then putting the hook there instead (ie how the other scripts and styles are enqueued in that section).

Didn't want to overstep, so I'm not submitting a PR, but the error-free code looks like this:

if ( ! $sd_widget_scripts ) {
    add_action('admin_enqueue_scripts', array( $this, 'enqueue_inline_scripts') );

   $sd_widget_scripts = true;

[truncated]

protected function enqueue_inline_scripts() {
    wp_add_inline_script( 'admin-widgets', $this->widget_js() );
    wp_add_inline_script( 'customize-controls', $this->widget_js() );
    wp_add_inline_style( 'widgets', $this->widget_css() );
}

Legacy Widgets???

Currently, legacy widgets display alongside blocks when editing a widget area.

Proposed solution:-

For users using Gutenberg to edit widget areas, auto-convert existing widgets to blocks then hide legacy widgets on the widgets edit screen. We ONLY hide on the widgets edit screen so as to support Elementor and other page builders that use legacy widgets.

Refactor for v2

The goal for v2 is to lower memory usage and have everything run more efficiently.

  • Split into multiple classes
  • add an argument that can limit what is created, 'output_types' => array( 'block', 'shortcode'), by default it should load all 3.
  • Add a settings screen to the WP Settings page so that users can globally disable loading as widgets.

For the last option, I think we should give it 3 options "Auto", "Active", "Disable".
When in auto we should try and check a few things to see if widget functionality is needed. For example;

Enhancement Idea: Multi Select

<?php if ( $multiple ) { echo "multiple"; } //@todo not implemented yet due to gutenberg not supporting it

Categories and tags are supported in Gutenberg - so can this mechanism not be used. Multi select is very useful for many complex situations like a blaock that needs to pick cpts from by taxonomy or status

Blocks not appearing in WP 5.5.

Since updating to WP 5.5, blocks (and widgets) created with WP Super Duper do not show up in the block inserter.
Nothing in the error log, so I'm not sure how to debug...

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.