Giter Site home page Giter Site logo

redux-framework-4's Introduction

Redux Framework

WordPress plugin WordPress

ATTENTION

While we recognize Redux could be embedded in a theme or plugin in the past, we are no longer supporting the practice. Too many developers are not keeping their Redux code up-to-date (which could easily accomplished with Composer). When users of the projects experience issues, they seek support from us, which we are unable to provide short of suggesting they contact the project author (you) and ask you to update your vendor code. This puts your users in the middle, and we'd prefer not to do that anymore.

Consequently, the vendor support plugin/extension for ace_editor has been discontinued. The ACE Editor will load exclusively via CDN. If your project requires a local installation of the ACE Editor JavaScript (whose size is substantial), please include it in your project and use the redux/<opt_name>/fields/ace/script filter to specify the URL to that script. The ace_editor field will use that URL to enqueue the ACE library.

Thank you for your kind attention in this matter.

New to Version 4.4

  • Content Field
  • COLOR SCHEMES Extension.
  • TABBED Extension.
  • TAXONOMY METABOXES!
  • USER PROFILE METABOXES!
  • ICON SELECT Extension.
  • The Extendify Templates and Patterns library have been unbundled from Redux. To continue using Extendify, please download the standalone plugin from the WordPress.org repository: https://wordpress.org/plugins/extendify

New to Version 4.3

  • METABOXES!
  • REPEATER EXTENSION!
  • SOCIAL PROFILES EXTENSION!
  • CUSTOM FONTS EXTENSION!
  • Multi Media extension.
  • DateTime extension.
  • JS Button extension.
  • Google Maps extension
  • Widget Areas extension (applies to Classic Widgets only).
  • Gutenberg Template Library updated to the new Extendify library. See more information here about this upgrade and how to access the legacy library: https://redux.io/gutenberg-template-library-upgrade.

New to Version 4.2

See the sample folder for examples of the new and improved fields.

  • Additional Typography features: Top and bottom margins, text shadow.
  • New Media Image Filters (greyscale, sepia, opacity, contrast, invert, blur, saturate, brightness, hue-rotate).
  • New Gradient Field Filters (type, reach, angle), including output for autogenerated CSS.
  • New Box Shadow field with output for autogenerated CSS.
  • New Flyout Submenus: flyout_submenus global arg.
  • New Alpha color option for color field: color_alpha field arg for fields that support color pickers.
  • Removed: async_typography global arg. Google no longer supports it. Use font_display with one of the following auto|block|swap|fallback|optional. See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display
  • Automatic update option for Google Fonts without a Pro subscription.

Join us on Slack

Redux Slack

Follow us on Social Media!

Follow us on X Like us on Facebook

Changelog

See Changelog.md

Documentation

Need a little help with Redux? Come check out our brand-new documentation site at devs.redux.io, chock-full of tutorials and examples!

Help Us Translate Redux

Please head over to the plugin page to learn how you can help us translate Redux quickly. Any and all translations are welcome. We appreciate your help! https://translate.wordpress.org/projects/wp-plugins/redux-framework/

Features

  • Uses the WordPress Settings API
  • Multiple built-in field types
  • Multiple layout field types
  • Fields can be overloaded with a callback function for custom field types
  • Easily extendable by creating Field Classes
  • Built-in Validation Classes
  • Easily extendable by creating Validation Classes
  • Custom Validation error handling, including error counts for each section, and custom styling for error fields
  • Custom Validation warning handling, including warning counts for each section, and custom styling for warning fields
  • Multiple Hook Points for customization
  • Import / Export Functionality — including cross-site importing of settings
  • Easily add page help through the class
  • Fully responsive options panel
  • Much more

What's new in version 4?

Core Rewrite

Our code base has been rebuilt from the ground up. With compartmentalized code, autoload, and class inheritance, Redux is now faster and more efficient than it's ever been!

Top of the Line Security!

Redux meets security standards laid out by WordPress Coding Standards, WordPress VIP Standards, and ThemeForest Guidelines. Focus includes escaping, sanitizing, nonces verification, and database query prep/caching.

Automatic Google Font Updates.

This is one of the crown jewels of Redux v4! Your users will have the ability to update Google Fonts as updates are available or automatic ‘behind the scenes’ updates. No more waiting for updates and no API key is required!

Field Sanitizing

Field sanitizing allows one to pass an array of function names as an argument to a field in which the return value will be the sanitizing string. This feature will only work with text-based fields, including text, textarea, and multi_text (ACE Editor and WP Editor not included).

One may use any existing function, including PHP functions, WordPress functions, and custom-written functions. The return value of any used function must be that of a string. Any other return value will be disregarded.

Please view the sample-config.php file for specific examples.

Select2 AJAX Loading

The AJAX loading routines for the select2 fields have been fixed/finished. See the 'capabilities' field in the demo panel for an example.

In the interim, this feature will only work when used in conjunction with the data argument (that is, the one that fetches WordPress data).

To set AJAX loading, add the 'ajax' => true argument to your select field. The min_input_length argument may also be added to specify how many characters should be typed before results are shown. The default is 1.

Field/Section Disabling

This feature has been requested quite a few times over the years. Fields and sections can now be disabled by adding the 'disabled' => true argument to either a section or a field. The section or field will then appear 'greyed out' and not respond to input. This comes in handy in the event one may want to offer teasers for premium versions of their products.

Since those with a little CSS know-how could easily reactivate disabled fields with a little CSS, we took the added precaution of having Redux remove any name attributes on disabled fields/sections. This way, even if a clever user reactivates the field, it will never save.

Updated Panel Interface

The option panel interface has been brought up to date with the current WordPress admin design. It is also now ‘theme aware.’ Panel colors will now follow suit with the selected admin theme.

Improved Field Validation

Due to the need for multiple field validations, Redux now supports an array of validations versus the previously limiting single argument. Validation results now appear in real time after a save without the need for a page refresh.

Full v3 Backward Compatibility

We take backward compatibility very seriously here and strive to maintain it. Redux v4 has been designed to act as a drop-in replacement to offer new functionality without breaking existing functionality.

FAQs

  1. Why should we use require_once instead of get_template_part?
  • First, because get_template_part is for... you guessed it, themes! Redux is designed to work with both themes and plugins.
  • Second, read this.
  1. Why shouldn't we edit sample-config.php in the plugin directory?
  • Because sample-config.php will be replaced at each update of the plugin. You will lose all your work.

redux-framework-4's People

Contributors

alfred-ta avatar dovy avatar erickyle avatar essamamdani avatar kprovance avatar lenonleite avatar mohammedeisa avatar mukeshpanchal27 avatar puleeno avatar tofandel avatar voldemortensen avatar webbudesign 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

redux-framework-4's Issues

Provide list of What's new in Redux Framework v4

Hello all,

There should be a list of "What's New" in v4 so theme developer can plan their next theme.

Currently I see new features in v4 are:

  • Ajax save option
  • New layout (not sure)
  • New Option (not sure)

So please create a new post and make it sticky so all visitors can see it.

Redux 4 Global Argument Error

Hi team redux,

I have found an error on the global argument database ( theme_mods, theme_mods_expanded ).
When I add the database like theme_mods or theme_mods_expended, I have found an error on saving of redux options and error is Ajax: warning.
And here is the errors list by actions.

PHP Warning: Illegal offset type in ReduxCore\framework.php on line 661.
PHP Stack trace:
PHP 1. {main}() wp-admin\admin-ajax.php:0
PHP 2. do_action() wp-admin\admin-ajax.php:173
PHP 3. WP_Hook->do_action() wp-includes\plugin.php:465
PHP 4. WP_Hook->apply_filters() wp-includes\class-wp-hook.php:310
PHP 5. Redux_AJAX_Save->save() wp-includes\class-wp-hook.php:286
PHP 6. Redux_Options->validate_options() ReduxCore\inc\classes\class-redux-ajax-save.php:80
PHP 7. ReduxFramework->set() ReduxCore\inc\classes\class-redux-options.php:923

This error was so hard to find out for me. Because I thought that error is in my PHP code. So, I sorted my PHP code so many times.

And the redux version is 4.0.1.9.

Regard
Themecat_Info

TODO: Customizer Sanitize/Validate & Section disable

As these things are hooked in Redux AJAX save, it's going to take some rewrites or trickery to implement.

Section disable requires someone grabbing field args and applying them in the creation of customizer sections. Have not figured that out yet.

Repeater Extension Error in WP Admin

Support Hash

https://support.redux.io/?id=7X91%2FP605ikM1%2Bc0E5l6iLSR%2FLZqcW%2B%2Bbu2YIfVOGak8%2FzaOUycs7RhrZGSSUZewtmNGhEfPh%2FnYhV9DGAQ%2BZA%3D%3D

Steps to reproduce

Install the Repeater Extension (v1.0.4) with the latest version of WP5 and Redux 4 Beta and view it in the Admin.

Expected Behavior

To work as expected.

Actual Behavior

UI appears broken. Cannot add repeaters. Console error.

Any Error Details (PHP/JavaScript)

Uncaught ReferenceError: redux is not defined at field_repeater.min.js?ver=1560767877:1

Output Argument

This option is extremely important for a project and I always make use of it.

As CSS increases its cascading effect it becomes difficult or even impossible to overlay the CSS that comes from the Redux Framework Output because it does not have the "!important" option.

Please implement in Redux V4 the possibility of adding "!important" in the output argument.

Ex:

'output-priority' => false, = color: red;
'output-priority' => true, = color: red !important;

Thanks and have a great day :)

Developer Mode Enabled with message "This has been automatically enabled because you are working in a localhost environment"

Support Hash

https://support.redux.io/?id=eyj63%2FOpTVSxHBSpkI%2B%2FFqV43Bk%2BjeUkd3IuEZlQ7n%2BrqiO8syNXW10a33PUj7MiDbxBk0VwaAicbIj0bsskWg%3D%3D

Steps to reproduce

The website is served on 127.0.0.1 on some port and via haproxy connected to a public IP. It is thus not local installation, but on a VPS. However, the plugin thinks it is local installation.

Expected Behavior

No local installation detected.

Actual Behavior

Local installation detected.

Any Error Details (PHP/JavaScript)

color_rgba field issue

## Support Hash
https://support.redux.io/?id=7X91%2FP605ikM1%2Bc0E5l6iLSR%2FLZqcW%2B%2Bbu2YIfVOGak8%2FzaOUycs7RhrZGSSUZewtmNGhEfPh%2FnYhV9DGAQ%2BZA%3D%3D

## Steps to reproduce
Add a simpe color_rgba field. e.g.

array(
  'id'        => 'opt-color-rgba',
  'type'      => 'color_rgba',
  'title'     => 'RGBA Color Picker',
  'default'   => array(
    'color'     => '#fdfdfd',
    'alpha'     => 1
  ),      
),

## Expected Behavior
To see the alpha channel

## Actual Behavior
Did not see the alpha channel, just normal color picker.

## Any Error Details (PHP/JavaScript)
No console errors.

Reset Section and Reset All not show appropiate message

I tried doing the reset of the redux settings and no message appears in the case of Reset Section or Reset All.

Looking at the code I could see that the condition

public function notification_bar() {
		    if ( isset( $this->parent->transients['last_save_mode'] ) ) {

is always false and the code never enters the if loop because $this->parent->transients['last_save_mode'] is empty.

Making a very empirical test I added the following two lines under the declaration of the notification_bar() method and before the if statment.

$this->parent->transients       = get_option( $this->parent->args['opt_name'] . '-transients', array() );
echo "<pre>"; print_r( $this->parent->transients['last_save_mode'] ); echo "</pre>";

Now both in case of Saving and Reset All the correct actions are taken (see the screens that show not only the messages but also the output of last_save_mode), while in the case of Reset Section last_save_mode does not take the value of defaults_section and therefore does not it works.

Screen 1: Saving
In this action the value of last_save_mode is nornal and show the correct message.
Normal

Screen 2: Reset Section
In this action last_save_mode is empty.
Section

Screen 3: Reset All
In this action the value of last_save_mode is defaults and show the correct message.
All

Limit the locations where redux-framework notifications are shown

When I was in the WordPress Admin area I noticed many different page types had a notice letting me know redux v4 was coming soon. I tweeted about this and was told to bring up the issue on github so hopefully I picked the right place.

My suggestion is to limit this only a few locations in the admin area. And, restrict it to certain user types (if it isn't already). This suggestion is inspired by the WordPress plugin guidelines. For example, if say the PayPal Express plugin is getting an update soon, we shouldn't see that notice while approving product reviews.

That is all. I had either dismissed the notice or picked the wrong site, so I can't provide screenshots. Sorry if it sounds like I am nagging. Communication is good but effective communication is better. Too many notifications create a boy who cried wolf scenario. And unrelated notifications (approving comments example above) is not good either.

Section not folding with required

As reported to me:

The 'required' arg does not toggle show/hide on type 'section' in v4.

I tested with v3 and all works ok.

array(
  'id' => 'section-hero-page',
  'required' => array( 'opt-hero', '=', true ),
  'type' => 'section',
  'title' => 'Page Hero',
  'indent' => true 
),

I'm getting more info about this to look into it.

Import/Export demo

Hi,

We are a team of developers who are beginning to publish our theme on Themeforest. We are facing an issue in presenting the demo of our theme and wanted to seek your help.

Whenever we try to export our theme demo content and import it somewhere else, the pictures don’t go in their correct position as before.
The image’s IDs in imported demo is not the same as ID’s in the exported demo. For example, Logo’s ID was 6 in exported demo but it was appeared in imported demo with number 21.
We use Wpbakery for page building and Redux Framework for theme option.

Is there a plugin or tool we can use to fix our problem or should we follow certain criteria?

Error In Section Field Type

Hi,
I have found an error in the section field type. When I add the info field type in the section and set the indent equal to true, then indent not work on the info field type. Also, section dependency does not work in the inner of this section, field type info.

And the redux version is 4.0.1.9

Regard
Themecat_Info

Non-static method WP_Feed_Cache::create()

Hi team redux,

I have found an error of Deprecated (Suppressed). The error appears on the WP Dashboard.
Here is the error:

Non-static method WP_Feed_Cache::create() should not be called statically
wp_dashboard()
wp-admin/index.php:148
do_meta_boxes()
wp-admin/includes/dashboard.php:235
Redux_Dashboard->redux_dashboard_widget()
wp-admin/includes/template.php:1304
wp_widget_rss_output()
wp-content/plugins/redux-framework/ReduxCore/inc/classes/class-redux-dashboard.php:54
fetch_feed()
wp-includes/widgets.php:1442
SimplePie->init()
wp-includes/feed.php:764
SimplePie_Registry->call()
wp-includes/class-simplepie.php:1313
wp-includes/SimplePie/Registry.php:215

And the redux version is 4.0.2

Regard
Themecat_Info

mode/library_filter don't work

Tried

'library_filter' => 'image',

and

'mode' => 'image',

and

'library_filter' => 'image',
'mode' => 'image',

And I still see videos in my results

Metabox Lite - button_set and switch not displaying

Support Hash

https://support.redux.io/?id=RC3g7AbPOQ1P7ELCADQfR4%2BflXCdTSQdMuoc%2FvTGJbjl1OQwr6sQn4L7yjSdO4vGlz1LSBrv4yBLzFRrY00PZA%3D%3D

Steps to reproduce

Add a 'button_set' or 'switch' type in Metabox Lite.

Expected Behavior

For the 'button_set' or 'switch' to appear.

Actual Behavior

Neither appeared.
Note that the other supported types appear (e.g. checkbox, radio, text, textarea, media, & color)

Any Error Details (PHP/JavaScript)

No errors.

The Redux::set_extensions() method throws a warning

The warning being thrown

open_basedir restriction in effect. File(/plugins/redux-framework-4/ReduxCore/inc/extensions/index.php/class-redux-extension-extensions.php) is not within the allowed path(s)

That's because the method is doing too much recursion, I can rewrite in a PR if needed

Also is it normal all those calls like

Redux_Functions_Ex::record_caller( $opt_name, debug_backtrace()[ array_search( __FUNCTION__, array_column( debug_backtrace(), 'function' ), true ) ]['file'] );

The double debug_backtrace is kinda hurting on performance.. And I checked, this function is not even registering them because of the strpos check.. Is it gonna be removed or is there gonna be a check on WP_DEBUG?

Metabox Lite saving issue when Custom Fields visible - WP5 with Gutenberg

Support Hash

https://support.redux.io/?id=7X91%2FP605ikM1%2Bc0E5l6iLSR%2FLZqcW%2B%2Bbu2YIfVOGak8%2FzaOUycs7RhrZGSSUZewtmNGhEfPh%2FnYhV9DGAQ%2BZA%3D%3D

Steps to reproduce

Add a Metabox Lite radio option. Enable 'Custom Fields' in Page/Post edit view (in WP5 using Gutenberg). Save the MBL option. After save and while on the page still, save the page again. You'll notice because the 'Custom Fields' was visible (which displays the Redux MBL options) they do not update on Save, so if you save again before refreshing the page, then your Redux MBL option will be overwritten by the previous settings.

Expected Behavior

Custom Fields (if visible) should update the Redux MBL value on Save.

Actual Behavior

Custom Fields (if visible) does not update the Redux MBL value on Save.

Any Error Details (PHP/JavaScript)

No errors.

redux-mbl-issue

Improve speed for core classes

Change all instances of:

if ( ! class_exists( 'ReduxFramework' ) ) {

to

if ( ! class_exists( 'ReduxFramework', false ) ) {

Verify this works with the base PHP version. This will speed things up.

Customizer Issues

The following fields (specific field configs) are not firing the redux_change method. Need to resolve.

  • radio
  • text
  • textarea
  • sortable toggle visibility
  • Palette
  • Color RGBA
  • button_set - (Multi select version works, retgular fails)
  • select dropdown invisible (css issue)
  • image_select preset
  • spinner
  • Validations don't work
  • Disabling doesn't work in customizer (css)

Feature Request: Settings page locking

I'd like to request an option to enable locking for the settings pages, just like how WordPress does post locking. I've been having issues with clients leaving the settings page open and never refreshing it, so when they make their daily update to a field and hit save, they're overriding everyone else's changes.

Redux_Typography not properly set

to avoid [13-May-2019 18:12:12 UTC] PHP Fatal error: Uncaught Error: Class 'Redux_Typography' not found in /home3/wp-content/plugins/redux-framework/ReduxCore/inc/classes/class-redux-output.php:164

goto:

ReduxCore/inc/fields/typography/class-redux-typography.php

copy that file to:

ReduxCore/inc/classes/class-redux-typography.php

Select Field not Saving

The select field is not saving. I recorded a video here: https://we.tl/t-C3lDcn6MQd

In my error log:
[05-Jun-2019 07:42:39 UTC] PHP Notice: Undefined index: opt_name in /XXX/wp-content/plugins/redux-dev-master/ReduxCore/inc/classes/class-redux-class.php on line 50

Its a simple select field:

                array(
                    'id'       => $cron.'sourcePostTypes',
                    'type'     => 'select',
                    'title'    => __( 'Source Post types', 'wordpress-multisite-sync' ),
                    'subtitle' => __( 'What post types do you want to sync? Attachments not working today!', 'wordpress-multisite-sync' ),
                    'data' => 'post_types',
                    'multi' => true,
                ),

The metabox extension does not correctly display the indicator to open / close the metabox using Gutenberg.

The metabox extension does not correctly display the indicator to open / close the metabox using Gutenberg or even the icons in the metabox.

This is the screen

Cattura

From JavaScript we understand that a class must be removed and an element added but the .toggle-indicator class does not seem to exist when redux is active. If the plugin is not active, it exists.

With plugin
Cattura

Without plugin
Cattura

I tried to disable the redux plugin and it works correctly. Can you fix it?

Please note that commenting the line

$( '.postbox .toggle-indicator' ).removeClass( 'toggle-indicator' ).addClass( 'el' );

in the redux-extension-metaboxes.js file the problem disappears and the buttons are displayed correctly.

Cattura

However, the icons are not displayed.

EDIT: The icons are break from the class .block-editor-page defined in css style. Comment this and now work fine.

Cattura

Add two-way binding

$("*[bind]").on('change keyup', function (e) {
 var to_bind = $(this).attr('bind');
 $("*[bind='"+to_bind+"']").html($(this).val());
 $("*[bind='"+to_bind+"']").val($(this).val());
})
$("div[bind]").bind("DOMSubtreeModified",function(){
 var to_bind = $(this).attr('bind');
 $("*[bind='"+to_bind+"']").html($(this).html());
 $("*[bind='"+to_bind+"']").val($(this).html());
}); 

Warning if no theme exists (yes it's possible)

Warning: strpos(): Empty needle in /tmp/wordpress/wp-content/plugins/redux-framework-4/ReduxCore/inc/classes/class-redux-functions-ex.php on line 174

That's an easy fix:
if ( strpos( $file_path, $real_path ) !== false ) {

if ( ! empty( $real_path ) && strpos( $file_path, $real_path ) !== false ) {

Business Cards

Which front do you like?

Option 1

screen shot 2013-11-29 at 22 39 53

Option 1b

front1b

Option 2

front2

Back

So you can see it.

back

Woocommerce endless spinning on checkout

I'm using Bemobile theme which depends on redux framework. If I activate Redux Framework I face issue with checkout page it spinning and not load. If I deactivate Redux Framework plugin the checkout will work without any issue but BeMobile thems will not work. Any Idea please.

Thanks in advance

Typo in class Redux_Core property.

These three properties

P

are incorrectly declared and many IDEs (eg phpStorm) complain of inconsistencies such as the lack of the __toString() method in the \project.

Cattura

If there is no valid reason to declare the type @var as a project (I don't know what reason it could be) I suggest to modify the declaration to reflect the type of data that they must contain so as not to confuse the ide that are already stupid on their behalf ;)

Google Fonts not loading on Front-end

Support Hash

https://support.redux.io/?id=7X91%2FP605ikM1%2Bc0E5l6iLSR%2FLZqcW%2B%2Bbu2YIfVOGak8%2FzaOUycs7RhrZGSSUZewtmNGhEfPh%2FnYhV9DGAQ%2BZA%3D%3D

Steps to reproduce

Use the Typography field with a Google Font. Within WP Admin it all works as expected. On the front-end however the Google Font does not load. Looking at the Browser Network Tab within the Console, the Google scripts are not there.
Note: They load as expected in Redux v3.

Expected Behavior

Google Font Scripts to load on front-end.

Actual Behavior

No scripts loading.

Any Error Details (PHP/JavaScript)

No errors.

Uploading .ico files

When uploading .ico files' favicon' in the options panel there is no preview image before saving like when you upload a jpeg, png or gif file. Is this a bug? Is there a fix for this? Thanks

Typography field opens "Settings have changed, you should save them!" notification.

Hello redux developer.

Im testing the last version of Redux Public Beta (4.1.7 in this moment) and the bug described here reduxframework/redux-framework#2466 has not been solved and presented as described by the user in the post I linked to.

Out of curiosity I tried to see the source code of the proposed fix but it doesn't seem compatible with this version.

For the rest, while using redux very sporadically in my projects, I think you are doing a great job.

Keep it up.

Embedding Redux framework 4 in theme

Embedding Redux framework 4 in theme without installing plugin give error loading Redux files.

Old Redux framework work ok, but this new version doesn't work. I think something is wrong in_theme the folder path.

// See if Redux is a plugin or not.

for example:

<link rel="stylesheet" id="redux-admin-theme-css-css" href="https://localhost/wordpress/wp-content/plugins/C:/xampp/htdocs/wordpress/wp-content/themes/my_theme/includes/redux-framework/ReduxCore/assets/css/colors/fresh/colors.css?ver=4.0.1.1.1551186467" type="text/css" media="all">

Redux try to load files always in plugin folder https://localhost/wordpress/wp-content/plugins/

Full file path in 'url' C:/xampp/htdocs/wordpress/wp-content/themes/my_theme/includes/redux-framework/ReduxCore/assets/css/colors/fresh/colors.css?ver=4.0.1.1.1551186467

only for testing

changing self::$url to get_template_directory_uri() . '/includes/redux-framework/ReduxCore/';

works partially.

Required as "any" or "all"

Suggestion by @chrishoward on slack.

I have writing a function to handle it. I’m sharing it in case it’s useful to others. It still depends on knowing all possible values, but they’re saved once in an array rather than being coded at each call. So now only the OR vals are coded at each call.

     function redux_required( $compare_field = '', $all_values = array(), $exclude_values = array(), $comparison = '!=', $inc_empty = TRUE ) {
      /*
       * When $comparison is != this effectively works as an OR for the $exclude_values
       */
      if ( empty( $compare_field ) || empty( $all_values ) ) {
        $return = array();
      } else {
        if ( $inc_empty ) {
          $return = array( array( $compare_field, $comparison, '' ) );
          $i      = 1;
        } else {
          $return = array();
          $i      = 0;
        }
        foreach ( $all_values as $k => $v ) {
          if ( ! in_array( $k, $exclude_values ) ) {
            $return[ $i ++ ] = array( $compare_field, $comparison, $k );
          }
        }
      }
      return $return;
    }

And the call looks something like this…

 'required' => redux_required( 'myfield', $field_types, array( 'link', 'email' ), '!=' )

In Redux, I’d suggest keeping it simple. Just adding an ANY (i.e. OR) parameter.

'required' => array(
    array('layout','equals','1'),
    array('parent','!=','Testing'),
    true
)

Then you just check if one of the values in the ‘required’ array is boolean true, if it is change your lookup logic to seek any of the values being matched.

ok @dovy. Looked at the code (v3). I think it’s pretty easy.
Where you’ve got
$return = $this->compareValueDependencies(...
You just need to track and pass the existing state and whether it’s an “ANY” case or “ALL” case. Thus you could do something like…

if ($any_all=='ANY') {
    $return = $current_state || $this->compareValueDependencies(...;
} else {
   $return = $current_state  && $this->compareValueDependencies(...; // Just did it this way for consistency
}

More details hopefully to be provided by @chrishoward.

Text field not show the correct type.

Hello, this is a screen from text field render via sample demo including in redux-framework-4. Definitely ugly to look if compared to other fields. For example, the password field.

Before

A fest check via code inspection report the input without type="text"

<input class="regular-text" id="text-example" name="redux_demo[text-example]" value="Default Text">

and in fact from the source code we can see that since the condition

if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) {
// cut
} else {

return false and the code is evaluated after else.

In this portion of the code there is no reference to the type attribute

$this->field['attributes']['id']          = $this->field['id'];
$this->field['attributes']['name']        = esc_attr( $this->field['name'] . $this->field['name_suffix'] );
$this->field['attributes']['value']       = $this->value;
$this->field['attributes']['placeholder'] = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : '';
$attributes_string                        = $this->render_attributes( $this->field['attributes'] );
echo '<input ' . $attributes_string . '>'; // phpcs:ignore WordPress.Security.EscapeOutput
}

and it is sufficient to add this line for solving the problem.

$this->field['attributes']['type']        = ! isset( $this->field['attributes']['type'] ) ? 'text' : $this->field['attributes']['type'];

Now it's definitely more pleasing.

After

and the input render the type attribute.

<input class="regular-text" id="text-example" name="redux_demo[text-example]" type="text" value="Default Text">

Complete render method

/**
		 * Field Render Function.
		 * Takes the vars and outputs the HTML for the field in the settings
		 *
		 * @since ReduxFramework 1.0.0
		 */
		public function render() {

			$this->field['attributes']            = wp_parse_args(
				isset( $this->field['attributes'] ) ? $this->field['attributes'] : array(),
				array(
					'qtip_title'   => '',
					'qtip_text'    => '',
					'class'        => isset( $this->field['class'] ) && ! empty( $this->field['class'] ) ? array( trim( $this->field['class'] ) ) : array(),
					'readonly'     => isset( $this->field['readonly'] ) && $this->field['readonly'] ? 'readonly' : '',
					'autocomplete' => isset( $this->field['autocomplete'] ) && false === $this->field['autocomplete'] ? 'off' : '',
				)
			);
			$this->field['attributes']['class'][] = 'regular-text';

			// Deprecated from the docs. Left as not to break user's code!
			if ( isset( $this->field['text_hint'] ) && ! empty( $this->field['text_hint'] ) ) {
				if ( ! is_array( $this->field['text_hint'] ) && is_string( $this->field['text_hint'] ) ) {
					$this->field['text_hint'] = array(
						'content' => $this->field['text_hint'],
					);
				} else {
					if ( isset( $this->field['text_hint']['title'] ) && ! empty( $this->field['text_hint']['title'] ) ) {
						if ( ! isset( $this->field['text_hint']['content'] ) || ( isset( $this->field['text_hint']['content'] ) && empty( $this->field['text_hint']['content'] ) ) ) {
							$this->field['text_hint']['content'] = $this->field['text_hint']['title'];
							unset( $this->field['text_hint']['title'] );
						}
					}
				}
				$this->field['attributes']['qtip_title'] = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : '';
				$this->field['attributes']['qtip_text']  = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : '';
			}

			if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) {
				if ( empty( $this->field['args'] ) ) {
					$this->field['args'] = array();
				}
				$this->field['options']               = $this->parent->wordpress_data->get( $this->field['data'], $this->field['args'], $this->value );
				$this->field['attributes']['class'][] = 'hasOptions';
			}

			if ( empty( $this->value ) && ! empty( $this->field['options'] ) ) {
				$this->value = $this->field['options'];
			}

			$this->field['attributes']['class'] = implode( ' ', $this->field['attributes']['class'] );

			if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) {
				if ( ! isset( $this->value ) || ( isset( $this->value ) && ! is_array( $this->value ) ) ) {
					$this->value = array();
				}
				foreach ( $this->field['options'] as $k => $v ) {
					$attributes = $this->field['attributes'];
					if ( ! isset( $this->value[ $k ] ) ) {
						$this->value[ $k ] = $v;
					}
					$attributes['value'] = $this->value[ $k ];
					if ( ! empty( $placeholder ) ) {
						$attributes['placeholder'] = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? esc_attr( $this->field['placeholder'][ $k ] ) : '';
					}
					$attributes['name'] = esc_attr( $this->field['name'] . $this->field['name_suffix'] . '[' . esc_attr( $k ) ) . ']';
					$attributes['id']   = esc_attr( $this->field['id'] . $k );

					$attributes['type'] = ! isset( $attributes['type'] ) ? 'text' : $attributes['type'];
					$attributes_string  = $this->render_attributes( $attributes );
					echo '<div class="input_wrapper"><label for="' . $attributes['name'] . '">' . $this->value[ $k ] . '</label><input ' . $attributes_string . '></div>'; // phpcs:ignore WordPress.Security.EscapeOutput

				}
			} else {
				$this->field['attributes']['id']          = $this->field['id'];
				$this->field['attributes']['name']        = esc_attr( $this->field['name'] . $this->field['name_suffix'] );
				$this->field['attributes']['type']        = ! isset( $this->field['attributes']['type'] ) ? 'text' : $this->field['attributes']['type'];
				$this->field['attributes']['value']       = $this->value;
				$this->field['attributes']['placeholder'] = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? esc_attr( $this->field['placeholder'] ) : '';
				$attributes_string                        = $this->render_attributes( $this->field['attributes'] );
				echo '<input ' . $attributes_string . '>'; // phpcs:ignore WordPress.Security.EscapeOutput
			}
		}

Bye

Customizer Beta

Hi,

I see "Customizer Beta" on Redux-Demo. Also the typography is available there. How can i use it. If i activate Customizer as true i see no typography options on the Customizer-Sidebar. I tried this with Redux 3x and Redux 4

Regards

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.