GithubHelp home page GithubHelp logo

docs's People

Stargazers

 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

docs's Issues

Siteorigin Conflicts with Lodash and Datatable

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

Attaching snapshot
3
4
5
6

Extending Existing Widgets

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 );

Page Builder Data Dump does not work

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?

Examples not working

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.

Fatal error: Uncaught ArgumentCountError in Creating a Widget tutorial

https://imgur.com/a/UllbvEj

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

'Extending Existing Widgets Tutorial' doesn't match what's in the code

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.

Add a Filter page for filtering the Post Loop

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' );

"widget_update_callback" action is not working

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.

Site Origin Editor Read More Option

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!!

Custom field, fields autoloader, file naming.

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/

Widget is not showing up

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');

1
2

Custom Row Style Field Hook

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

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.