siteorigin / docs Goto Github PK
View Code? Open in Web Editor NEWSiteOrigin developer documentation.
Home Page: https://siteorigin.com/docs/
SiteOrigin developer documentation.
Home Page: https://siteorigin.com/docs/
Add a filtering example for siteorigin_widgets_posts_selector_query
.
/**
* Filter the SiteOrigin Widget Post Loop.
*/
function surf_emporium_events_exclude_term( $query ) {
$terms = array(
'taxonomy' => 'event_categories', // This is the taxonomy name.
'field' => 'term_id',
'terms' => 1625, // Term to exclude.
'operator' => 'NOT IN'
);
// Is there a taxonomy query already present?
if ( is_page( 59427 ) ) {
return $query;
} elseif ( isset( $query['tax_query'] ) ) {
$query['tax_query'][] = $terms;
$query['tax_query']['relation'] = 'AND';
} else {
$query['tax_query'][] = $terms;
}
return $query;
}
add_filter( 'siteorigin_widgets_posts_selector_query', 'surf_emporium_events_exclude_term' );
On the Enqueue Frontend Scripts Action page, there's a link to the Initializing a Widget page. However, that link is broken. It goes to https://siteorigin.com/docs/widgets-bundle/getting-started/initializing-a-widget/ rather than https://siteorigin.com/docs/widgets-bundle/getting-started/initialising-a-widget/. The first link has the correct spelling of the word "initializing" in the URL, but the second is the one that actually works.
https://siteorigin.com/docs/widgets-bundle/getting-started/extending-existing-widgets/
Example 1 -
widgets/so-button-widget/so-button-widget.php
does not exist, but wp-content/plugins/so-widgets-bundle/widgets/button/button.php
does.
Example 2 -
The code described below is not what is available in button.php. The 4th argument is an empty array which appears to be $control_options
.
In the __construct function, you'll see that the 4th argument is an array that specifies the form. The button widget has a
section called design and in that, a field called theme.
class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
function __construct() {
parent::__construct(
'sow-button',
__('SiteOrigin Button', 'so-widgets-bundle'),
array(
'description' => __('A powerful yet simple button widget for your sidebars or Page Builder pages.', 'so-widgets-bundle'),
'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
),
// 4th arg
array(
),
false,
plugin_dir_path(__FILE__)
);
}
The SiteOrigin_Widget class is showing the 4th argument as $control_options
, not $form_options
:
function __construct($id, $name, $widget_options = array(), $control_options = array(), $form_options = array(), $base_folder = false) {
$this->form_options = $form_options;
$this->base_folder = $base_folder;
$this->field_ids = array();
$this->fields = array();
Looks like the Widget Bundle code was reformatted and the docs were not. If you can confirm that this is the case and I'm not just missing something, I will work through the tutorial and try and piece the differences together and rewrite those portions as I go.
documentation in this page is broken. https://github.com/siteorigin/docs/blob/develop/widgets-bundle/advanced-concepts/actions/initialize-widget.md
Hi
I am a newbie to wordpress development and i might not be with the standards. Kindly excuse.
I created a plugin using wordpress plugin boilerplate and used lodash and datatable for my need. I am done with that.
Now, when i try to create another page, i am seeing siteorigin rows are not visible. The reason is conflict with underscore, lodash and Datatable.
Any solution towards this.
Thanks
We should create indexes for any directories. As an example of an index, open this page and click the Advanced Concepts or Filters link in the breadcrumb you'll get an error message. That page should really contain an index instead.
Siteorigin is not happy for the following issues,
1.negative margin in measurement field:
it's work fine in css, but for (e.x) I gave -40(negative) and save the value, the field will show only 40 (positive) value.
2.in_widget_form
action is working good ,but "widget_update_callback" action is not working when rendering to update the widgets value.
More of a documentation clarification request for https://github.com/siteorigin/docs/blob/develop/widgets-bundle/getting-started/extending-existing-widgets.md
The snippet for changing the template file could use some clarification around the if
statement that allows the filename to get replaced. In my use case $instance['design']
was empty so I removed this check and everything seems to be working as expected.
function mytheme_button_template_file( $filename, $instance, $widget ){
if( !empty($instance['design']['theme']) && $instance['design']['theme'] == 'test' ) { // What's the purpose of this line?
// This option works for plugins
$filename = plugin_dir_path( __FILE__ ) . 'tpl/button.php';
// And this one for themes
$filename = get_stylesheet_directory() . '/tpl/button.php';
}
return $filename;
}
add_filter( 'siteorigin_widgets_template_file_sow-button', 'mytheme_button_template_file', 10, 3 );
The first link in the file: https://github.com/siteorigin/so-dev-examples/tree/develop/extend-widgets-bundle/custom-fields/ takes me to a 404.
Thanks
Hi,
I enabled debug mode in wp-config.php, and added both lines of code to the end of wp-config.php.
Then I entered in admin the page that I want a Data Dump from.
Next I went to the frontend and opened the HTML source and searched for "Page Builder Data".
Unfortunately I cannot find any dump.
Is this description still right?
Hey,
Page in question: https://siteorigin.com/docs/widgets-bundle/getting-started/creating-a-widget/
Where does one add all the code? It literally just has a file tree and code dumps ... there doesn't seem to really be anything clear to say where code snippet A goes etc.?
Guys, i almost got bald because of this today:
When adding custom field, file containing field class, must have .class.php
extension!
As stands in siteorigin-widget-field-class-loader.class.php:
//(...)
$filepath = $class_path . $filename . '.class.php';
//(...)
IMO this should be mentioned in docs, bold!, or fields autoloader should look for files field-name.class.php
OR field-name.php
KUDOS to this guy, without his post i would never suspect bad filename.: https://siteorigin.com/thread/custom-field-i-created-always-returns-an-error-in-the-backend/
Hi all,
I'm using Site Origin Page Builder for my site.
It works well. But the thing is when I added site origin editor widget read more option is not working.
May I know what to do.
Thank you in advance!!
Hi!
I think in https://siteorigin.com/docs/widgets-bundle/form-building/form-fields/ we need element where we can add info for clients and line to separate fields.
Hi.. I am trying to follow your tutorial and my widget is not showing up in the list. I am litreally new to Wordpress customization.
functions.php
function add_my_awesome_widgets_collection($folders) {
$folders[] = __DIR__ . '/barter-widgets';
return $folders;
}
add_filter('siteorigin_widgets_widget_folders', 'add_my_awesome_widgets_collection');
<?php
/*
Widget Name: Barter Login Widget
Description: A widget that allows the user to login
Author: Alaksandar Jesus Gene
*/
class Barter_Login_Widget extends SiteOrigin_Widget {
function __constructor() {
echo "Hello I am run from constructor";
}
function get_template_name($instance) {
return '';
}
function get_style_name($instance) {
return '';
}
}
siteorigin_widget_register('barter-login-widget', __FILE__, 'Barter_Login_Widget');
Update the bundling docs: https://siteorigin.com/docs/page-builder/bundling-prebuilt/.
The code here - https://siteorigin.com/docs/page-builder/hooks/custom-row-settings/
function custom_row_style_attributes( $attributes, $args ) {
if( !empty( $args['parallax'] ) ) {
array_push($attributes['class'], 'parallax');
}
return $attributes;
}
add_filter('siteorigin_panels_row_style_attributes', 'custom_row_style_attributes', 10, 2);
"To add a new attribute, add both a new key and value to $attributes. Example: $attributes['data-video-id'] = $args['video-id']; will add data-video-id="9" to the row element."
Thanks for building these hooks but this example isn't clear. I am looking to add a background image using data-bg. So my code would look like this:
function custom_row_style_fields($fields) {
$fields['lazyload'] = array(
'name' => __('Lazy Load', 'siteorigin-panels'),
'type' => 'text',
'group' => 'attributes',
'description' => __('Add image url for lazy loading', 'siteorigin-panels'),
'priority' => 8,
);
return $fields;
}
add_filter( 'siteorigin_panels_row_style_fields', 'custom_row_style_fields' );
function custom_row_style_attributes( $attributes, $args ) {
if( !empty( $args['lazyload'] ) ) {
array_push($attributes['data-bg'], $args['lazyload']);
}
return $attributes;
}
add_filter('siteorigin_panels_row_style_attributes', 'custom_row_style_attributes', 10, 2);
However, only 'data-bg' is being added to the element but I am unable to capture the value.
Appreciate your help.
Thanks,
Mark
please delete it . It was a mistake.
We need to write a guide on how to use siteorigin_panels_local_layouts_directories.
docs > widgets-bundle > getting-started >creating-a-widget.md in siteorigin:develop
Following the Creating a Widget tutorial and, when it says I should now see an 'Untitled Widget', in Plugins>SiteOrigin Widgets, errors are thrown (see copy pasta below/screenshot above) at that page.
I am finding that if I comment out the code block in the Widget Class section and refresh, the errors go away.
As far as following the tutorial, I personalized the metadata in the widget .php file, but did not alter the class extension code block at all as it doesn't say that you need to.
Fatal error: Uncaught ArgumentCountError: Too few arguments to function SiteOrigin_Widget::__construct(), 0 passed in /Users/timandes/Local Sites/tim-andes-test/app/public/wp-content/plugins/so-widgets-bundle/so-widgets-bundle.php on line 645 and at least 2 expected in /Users/timandes/Local Sites/tim-andes-test/app/public/wp-content/plugins/so-widgets-bundle/base/siteorigin-widget.class.php on line 53
ArgumentCountError: Too few arguments to function SiteOrigin_Widget::__construct(), 0 passed in /Users/timandes/Local Sites/tim-andes-test/app/public/wp-content/plugins/so-widgets-bundle/so-widgets-bundle.php on line 645 and at least 2 expected in /Users/timandes/Local Sites/tim-andes-test/app/public/wp-content/plugins/so-widgets-bundle/base/siteorigin-widget.class.php on line 53
I have temporarily set my language settings to Deutsche and all is well....
You get these errors when activating the examples:
Fatal error: Class 'SiteOrigin_Widget_MyAwesomeWidget_Widget' not found in C:\xampp2\htdocs\dropout-wp\wp-includes\widgets.php on line 560
Fatal error: Class 'SiteOrigin_Widget_HelloWorldWidget_Widget' not found in C:\xampp2\htdocs\dropout-wp\wp-includes\widgets.php on line 560
Fatal error: Class 'SiteOrigin_Widget_WidgetFormFields_Widget' not found in C:\xampp2\htdocs\dropout-wp\wp-includes\widgets.php on line 560
To make it work you have to rename them to:
Widget_Form_Fields
SiteOrigin_Widget_WidgetFormFields_Widget
My_Awesome_Widget
SiteOrigin_Widget_MyAwesomeWidget_Widget
Hello_World_Widget
SiteOrigin_Widget_HelloWorldWidget_Widget
The issue is with the siteorigin_widget_register function:
function siteorigin_widget_register($name, $path){
global $siteorigin_widgets_registered, $siteorigin_widgets_classes;
$siteorigin_widgets_registered[$name] = realpath( $path );
$siteorigin_widgets_classes[] = 'SiteOrigin_Widget_' . str_replace( ' ', '', ucwords( str_replace('-', ' ', $name) ) ) . '_Widget';
}
This is because the function wraps all the newly added widgets with: SiteOrigin_Widget_"widget_name"_Widget and removes "-", which are used in the naming of the examples:
siteorigin_widget_register('hello-world-widget', __FILE__, 'Hello_World_Widget');
siteorigin_widget_register('my-awesome-widget', __FILE__, 'My_Awesome_Widget');
siteorigin_widget_register('widget-form-fields', __FILE__, 'Widget_Form_Fields');
I opened a ticket instead of changing anything, because I am not sure how you will solve the issue.
Possible solutions:
Change the docs, so that developers know that they have to wrap their classes with your naming and watch out to not use "-" in widget names.
Or edit the siteorigin_widget_register function, but that means you will also need to rename your widgets inside the SiteOrigin Extend Widgets Bundle Plugin.
Sorry for the wall of text, I hope I did not miss anything or made an issue out of nothing.
Add a new section to the developer docs and provide info on siteorigin_panels_layout_builder_supports
.
These form fields are currently undocumented.
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.