ayecode / wp-super-duper Goto Github PK
View Code? Open in Web Editor NEWA WordPress Class to build a widget,shortcode and Gutenberg block, from the creators of https://wpgeodirectory.com
Home Page: https://geodirectoryexperts.com
A WordPress Class to build a widget,shortcode and Gutenberg block, from the creators of https://wpgeodirectory.com
Home Page: https://geodirectoryexperts.com
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.
This project needs some code style as it is now it is very dramatic with mixed rules.
This class is almost approaching 3000 lines of code. It might be time to finally divide it into several classes.
I am maintainer of https://github.com/WPBP/Widgets-Helper that has a lot of features like more fields and custom callbacks for validations.
I guess that port those there can be helpful.
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?
Looks like we should cache the results on the page per CPT?
Ping me if you need help.
๐
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.
Have you considered types such as radio button and also toggles ( like advanced fie true / false ?
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.
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() );
}
https://github.com/AyeCode/wp-super-duper/blob/master/wp-super-duper.php#L1786
This is a tough one, spend a few hours on it but if you can't resolve let me know.
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.
The goal for v2 is to lower memory usage and have everything run more efficiently.
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;
If no active old style widgets
Check if any builders are active, eg; Elementor we use widgets so we would need to keep it active in that case.
Add ability to convert current widget to blocks.
Hopefully this is as simple as it looks, https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/#2-add-a-block-transform
Hopefully we don't have to enable it in rest API, but if we do lets make it temporary.
Hide widgets from legacy selector
https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/#3-hide-the-widget-from-the-legacy-widget-block
Add option to enable/disable legacy widgets.
<?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
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...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.