Discussion on Xbox Framework - Create Meta boxes, Theme Options & Admin Pages for WordPress

MaxLopez

MaxLopez supports this item

Supported

This author's response time can be up to 1 business day.

40 comments found.

Hi,

I have a question regarding https://codecanyon.net/item/xbox-framework-create-meta-boxes-theme-options-admin-pages-for-wordpress/19250995.

Can I create a free WordPress plugin using the xbox framework and upload it to wordpress directory by just buying 1 license of this framework?

Sorry, got the answer from https://codecanyon.net/licenses/standard.

Regards,

Hi,

This is my code: <?php require_once( 'wpparseCore/xbox.php' ); add_action( 'xbox_init', 'wppwb_admin_page'); function wppwb_admin_page(){ $wppwb_options = array( 'id' => 'wppwb-admin-page',//It will be used as "option_name" key to save the data in the wp_options table 'title' => 'Test', 'menu_title' => 'Test', 'skin' => 'teal', 'header' => array( 'icon' => '<img src="'.XBOX_URL.'/img/xbox-light.png" />', 'desc' => 'Test', )); $xbox = xbox_new_admin_page( $wppwb_options ); $xbox->add_field(array( 'id' => 'custom-switcher', 'name' => __( 'custom', 'textdomain' ), 'type' => 'switcher', 'default' => 'no', 'options' => array( 'on_value' => 'yes',//Default: on 'off_value' => 'no'//Default: off ) )); // Getting Values $xbox = Xbox::get( 'wppwb-admin-page' ); $value = $xbox->get_field_value( 'datetisdsdme-switcher' ); // If Date Time Switch in On if($value == 'yes') { // do something } } ?> But I want to get fields values outside of function wppwb_admin_page() independently, so I could require_once a file which has a class. I want this code: // Getting Values $xbox = Xbox::get( 'wppwb-admin-page' ); $value = $xbox->get_field_value( 'datetisdsdme-switcher' ); // If Date Time Switch in On if($value == 'yes') { // do something }

outside of function wppwb_admin_page().

Is it possible?

of course, read the “Get field values for Admin Pages” section of this page:

http://xboxframework.com/documentation/getting-started/create-fields-and-get-field-values/

Hello, you expect to range field?

You could use two number fields.

Hi! How can I read the contents of a file and paste it into the code editor?

The above should work well.

But you could try to get the value from $ _POST

add_action('xbox_after_save_field_read-css-from-file', 'create_custom_files', 10, 3); function create_custom_files( $value, $field, $updated ){ $file_path = dirname(__FILE__) .'/example/example-css-code.php'; $value = $_POST['read-css-from-file']; //If you just want to save when there were changes. if( $updated ){ file_put_contents( $file_path, $value ); } }

POST do not work :( I do add_action(‘xbox_after_save_field_read-css-from-file’, ‘create_custom_files’, 10, 3); function create_custom_files( $value, $field, $updated ){ $file_path = dirname(FILE) .’/example/example-css-code.php’; $xbox = Xbox::get( ‘my-admin-pagel’ ); $value = $xbox->get_field_value( ‘read-css-from-file’); //If you just want to save when there were changes. if( $updated ){ file_put_contents( $file_path, $value ); } }

it is work!

Great

Is there any prediction of conditional fields?

Hi alanmosko, I recently added a conditional field functionality.

It’s still in beta, but it works pretty well. If you like, give me your email to send you the update.

This looks perfect for a couple of project that I’m working on, one of which would be an extended license.

I do have a question – is there a hook or easy way that you can provide to run a function when settings are saved?

In my scenario, if the user changes some typography settings, I’d like a hook that would trigger my function to dump the values to a CSS file. There are other options that I may wish to dump to a JS file. If there was an on_save hook, it would allow me to do this fairly easily.

I can make it work either way… I was just wondering if you had input. Thank you, Daniel

Hi Daniel.

Of course you can do that, in fact I’ve been working on a project where I need to do that.

If you want to detect changes in any field using javascript and immediately execute your code then you can do something like:

$('.xbox-type-colorpicker .xbox-element').on('xbox_changed_value', function( event, value ){ console.log( 'colorpicker changed:' ); console.log( value ); });

There are more examples at the end of this file:

http://xboxframework.com/files/xbox-events.js

I recently added some filters and actions when saving the fields:

When all fields are saved $data = apply_filters( 'xbox_filter_data_for_save', $data ); do_action( "xbox_before_save_fields", $data, $this->object_id, $this ); do_action( "xbox_before_save_fields_{$this->object_type}", $data, $this->object_id, $this ); //code save all fields do_action( "xbox_after_save_fields", $data, $this->object_id, $updated_fields, $this ); do_action( "xbox_after_save_fields_{$this->object_type}", $data, $this->object_id, $updated_fields, $this ); When you save each field do_action( "xbox_before_save_field", $field->id, $value, $field ); do_action( "xbox_before_save_field_{$field->id}", $value, $field ); $updated = $field->save( $value ); do_action( "xbox_after_save_field", $field->id, $value, $field, $updated ); do_action( "xbox_after_save_field_{$field->id}", $value, $field, $updated );

This is a simple example I made for another user.

have a nice day Daniel…regards

Perfect, thank you for the excellent and prompt response!

I’m having a little trouble understanding Envato’s licensing terms. It appears that the difference between the Standard and Extended licenses is that the latter may be included in a paid product. It also says that the Standard may be used it a free end product (so… a plugin that’s uploaded to the WordPress repo?) https://codecanyon.net/licenses/standard Their F.A.Q. for “Use in stock items/templates” seems to contradict their license matrix in some circumstances, unless the item is GPL’d. Since it is considered a derivative of WordPress, I assume that it is also GPL’d. So… given “Exception 3,” it appears that the “Use in stock items/templates” exclusion does not apply here, correct? https://codecanyon.net/licenses/faq#small-element-stock-a

Summary of my interpretation: I can use it in one free plugin (per license purchased) uploaded to the WordPress.org repo, et al, or I can use it in one plugin/theme (per license purchased) that is sold. Yes?

Hmm, the other curious thing is that folks use Envato extended licenses in products all of the time. Just search for WordPress themes on Code Canyon. Many, if not most of them, may include Visual Composer and/or Slider Revolution, among others.

None of this makes sense and the enforcement seems dubious, and possibly corrupt (ie, Envato is happy to send DMCA notices on behalf of WPBakery because they are a big profit center for them).

I am basically going to go with your original response as it seems the safest presumption.

More reading… This page seems to suggest that the Extraction clause is irrelevant to GPL items (such as your PHP code), but not for non-GPL elements (such as any custom code that you created in your “libs/xbox*” directories or images). (Reference: “What about Envato’s license?” at http://bit.ly/2qbPrhw)

Although bizarre, I understand the wording. However, it seems that by offering a demo where the files are clearly linked would invalidate this clause as well.

It is all so confusing in order to be compliant. IANAL

EDIT: I hope that you are not irritated with me. Your prompt explanations have been appreciated and helpful. Thank you!

Wow, yes indeed everything is very confusing, but as mentioned in this article http://bit.ly/2qbPrhw) .... Themes and plugins sold on Envato Market are sold under the default split license. This means authors can protect their rights and freedoms to respect (and comply with) the GPL as well as control their own work.

“Envato Market’s license for themes or plugins sold on the Envato Market sites covers all the components of these items, except for the specific components covered by the GPL”

Therefore, clause 11 that you mentioned should only refer to the part covered by the Envato license, not the GPL.

With regard to what you say about plugins being used in themes that are sold here on Envato, I imagine they do using the Extended License + the permission of the author of the plugin.

It’s just my guess, I suppose they agree on a profit percentage or something.

This I say based on the exceptions of what can be done with the Extended License, explained in this article.

https://codecanyon.net/licenses/faq#small-element-stock-a

... Don’t worry, this conversation has made me learn a little more about the Envato licenses, although the truth is still a little confusing for me.

Regards :)

This is just an FYI – Okay, so I purchased a regular license because I wanted to try it out. On OS X Sierra, I wasn’t able to extract the archive when I downloaded it from the Envato downloads area. I got this error (which I have never received on other plugins downloaded from Envato): https://f001.backblazeb2.com/file/hendricks/tmp/xbox-framework-extraction-error.png

Fortunately, I was able to extract it by converting the ZIP to tar.gz (whatever it didn’t like must have been wiped by the conversion).

I just thought that I would bring it up in case you wanted to know. TY

If I purchase an Extended License, do I have permission to use it in a premium/sold theme?

Hi Daniel,

Of course, you have my permission :) , but for each of your premium themes available for sale you should obtain a separate Extended License.

An use it only in premium themes which are sold on ThemeForest market exclusively.

Thank you, and yes, I would of course purchase a license for each product that it is is used in (currently, I only have one free plugin that it is used in which I already have a license for, and I am going to purchase an extended license soon for a premium theme – neither products have been released to the public yet, the plugin is close, but the theme has a lot of work to do yet).

I was not aware of the ThemeForest exclusivity for extended, so I’m glad that you mentioned it.

Thanks again, Daniel

When will leave the next official version?

I’m using 1.1.4.

Hello, I have already sent the latest version, but it is still under review.

If you want, give me your email to send you a download link right now.

my email moskoweb@gmail

I already sent you the update.

I little bit confuse, is mean this is a plugin, and i can create admin area customize as i want, for my author and general registered user without do coding ? i try your demo, but there is no visual page to show my customize setting, any link for show the sample result ?

Hi.

My plugin allows you to easily create metaboxes or admin pages.

The options have to be added by code.

Here in the documentation I explain more detailed:

http://xboxframework.com/documentation/


That is, it is a plugin for theme developers or plugins for wordpress.

I recently created a plugin using Xbox Framework.

https://codecanyon.net/item/masterpopups-multipurpose-popup-plugin-for-wordpress-with-easy-email-marketing-integration/20142807

Hello, I would like to know if there’s a template for creating themes with the Xbox, or at least, how to add it to use for creating the admin theme. Thank you.

Hi Alan, I have sent a message to your email.

siete25

siete25 Purchased

Hi, presale question, can i output values to javascript?

Hi siete25

Of course: Each time you make a change in a field, you can get that value in the event “xbox_changed_value”.

Two examples:

Works for any field: http://xboxframework.com/files/xbox-events.js

Hey is it possible to have repeater field groups like ACF pro ?

Hi numero7

You can use the group field ( it is repeatable and sortable).

http://xboxframework.com/documentation/field-types/group/

perfect :-)

thanks numero7

Hey trying to activate the plugin but got errors… I’m on local with a virtual server run by flywheel.. is there anything i missed. I also had trouble unextracting the archive on my mac.

Warning: include(/app/public/wp-content/plugins/xbox/example/admin-page.php): failed to open stream: Permission denied in /app/public/wp-content/plugins/xbox/xbox.php on line 36 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.0112 2120728 include_once( ’/app/public/wp-content/plugins/xbox/xbox.php’ ) .../wp-settings.php:303 Call Stack
  2. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.0112 2120728 include_once( ’/app/public/wp-content/plugins/xbox/xbox.php’ ) .../wp-settings.php:303
Warning: include(): Failed opening '/app/public/wp-content/plugins/xbox/example/admin-page.php' for inclusion (include_path='.:') in /app/public/wp-content/plugins/xbox/xbox.php on line 36
( ! ) Warning: include(/app/public/wp-content/plugins/xbox/example/metabox.php): failed to open stream: Permission denied in /app/public/wp-content/plugins/xbox/xbox.php on line 37 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.0112 2120728 include_once( ’/app/public/wp-content/plugins/xbox/xbox.php’ ) .../wp-settings.php:303
( ! ) Warning: include(): Failed opening ’/app/public/wp-content/plugins/xbox/example/metabox.php’ for inclusion (include_path=’.:’) in /app/public/wp-content/plugins/xbox/xbox.php on line 37 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.0112 2120728 include_once( ’/app/public/wp-content/plugins/xbox/xbox.php’ ) .../wp-settings.php:303
( ! ) Warning: include(/app/public/wp-content/plugins/xbox/includes/class-autoloader.php): failed to open stream: Permission denied in /app/public/wp-content/plugins/xbox/loader.php on line 85 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.1421 6257536 do_action( ) .../wp-settings.php:448 7 0.1421 6257912 WP_Hook->do_action( ) .../plugin.php:453 8 0.1421 6257912 WP_Hook->apply_filters( ) .../class-wp-hook.php:323 9 0.1494 6378904 XboxLoader120->load_xbox( ) .../class-wp-hook.php:298 10 0.1495 6379208 XboxLoader120->class_autoloader( ) .../loader.php:35
( ! ) Warning: include(): Failed opening ’/app/public/wp-content/plugins/xbox/includes/class-autoloader.php’ for inclusion (include_path=’.:’) in /app/public/wp-content/plugins/xbox/loader.php on line 85 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.1421 6257536 do_action( ) .../wp-settings.php:448 7 0.1421 6257912 WP_Hook->do_action( ) .../plugin.php:453 8 0.1421 6257912 WP_Hook->apply_filters( ) .../class-wp-hook.php:323 9 0.1494 6378904 XboxLoader120->load_xbox( ) .../class-wp-hook.php:298 10 0.1495 6379208 XboxLoader120->class_autoloader( ) .../loader.php:35
( ! ) Fatal error: Uncaught Error: Class ‘Xbox\Includes\Autoloader’ not found in /app/public/wp-content/plugins/xbox/loader.php on line 86 ( ! ) Error: Class ‘Xbox\Includes\Autoloader’ not found in /app/public/wp-content/plugins/xbox/loader.php on line 86 Call Stack
  1. Time Memory Function Location 1 0.0002 366024 {main}( ) .../plugins.php:0 2 0.0002 366696 require_once( ’/app/public/wp-admin/admin.php’ ) .../plugins.php:10 3 0.0003 367176 require_once( ’/app/public/wp-load.php’ ) .../admin.php:31 4 0.0004 367952 require_once( ’/app/public/wp-config.php’ ) .../wp-load.php:37 5 0.0005 374920 require_once( ’/app/public/wp-settings.php’ ) .../wp-config.php:81 6 0.1421 6257536 do_action( ) .../wp-settings.php:448 7 0.1421 6257912 WP_Hook->do_action( ) .../plugin.php:453 8 0.1421 6257912 WP_Hook->apply_filters( ) .../class-wp-hook.php:323 9 0.1494 6378904 XboxLoader120->load_xbox( ) .../class-wp-hook.php:298 10 0.1495 6379208 XboxLoader120->class_autoloader( ) .../loader.php:35

Give me your email to send you an update

okay never mind, i’ve installed the plugin from the wp dashboard and it works :-)

hi i was just wondering if i use this to create my theme options – is there a way to integrate it into the wordpress theme customizer?

Hope that makes sense!

Hi redflamemedia

It Cannot be used in Customizer.

Conditional Fields: https://image.prntscr.com/image/fTz3PT_gS8uDP80buzIOVA.png
Conditional Fields Options: https://image.prntscr.com/image/hJzQpv8HSQWLCBlSmnjZPw.png


Repeater fields: Most fields are repeatable.Just use the parameter “repeatable => true”

https://image.prntscr.com/image/cMk3jHyNRi63yPJ7_m-gaA.png
http://xboxframework.com/documentation/getting-started/field-parameters/
And of course, you can add html within the description of the fields. https://image.prntscr.com/image/cu04BoZ_QASRvCjdOoB9gQ.png

awesome thanks – looking to purchase soon for a new project!

thanks :)

Que tal Maxi! no me había dado cuenta que hablabas español, acabo de comprar tu plugin de xbox framework, hace tiempo te pregunté que si podia colocar valores dentro de javascript, te comento mi proyecto, es una calculadora de precios y todo está perfecto, lo único que necesito es poder modificar el precio, podria mandarte como va el js, y me digas como pondria el valor ahí? quizas no me expliqué muy bien, espero que si jaja

Espero que te sirva

siete25

siete25 Purchased

Me siento como idiota mandando nuevos mensajes en lugar de responderlos, puedo agregar el output como un shortcode? y creo que si necesito un poco más de tu ayuda =( para lo del valor en js

jajaja no te preocupes, hablamos por email.

siete25

siete25 Purchased

Maxi! me llamo Benji, tengo 2 preguntas para ti, podrías escribirme un correo a benji@agencywhy.com por favor? te lo agradecería muchisimo, gracias!

Hola Benji, ya estoy leyendo el mensaje que me enviaste

Hi,

can your plugin add metabox for specific page id or by template name like ACF plugin does?

I see on documentation post_types’ => array(‘post’, ‘page’) but no info about ids, template name.

Thanks.

Hi mgstudiolt.

Yes, it is possible to display the metabox on specific pages.

I’ve already added it to the documentation.

https://image.prntscr.com/image/augDu4gRRlC7W65vyISh9w.png
pandacorp

pandacorp Purchased

Hi,

First thank you for this awesome work!

I have one question please. Can you tell me if there is a way to auto save default values during theme or plugin activation?

Thanks!

Seb

Hi pandacorp, thanks.

Not for now, but I just made an update that will allow you to do it.

Give me your email to send you the update that allows you to do that.

After updating, you should do something like this:

add_action('after_switch_theme', 'save_xbox_fields'); register_activation_hook(__FILE__, 'save_xbox_fields'); function save_xbox_fields(){ $xbox_id = 'my-theme-options'; //Only save the default fields if it have not yet been saved. if( get_option( $xbox_id ) === false ){ $xbox = xbox_get( $xbox_id ); if( $xbox ){ $xbox->save_fields(0, array( 'display_message_on_save' => false )); } } }
pandacorp

pandacorp Purchased

Hi, thank you for the answer! It’s great ;)

No problem I will send you my email address by private message.

Thanks again!

sent

Lenit23

Lenit23 Purchased

Hello, I will probably pass for a noob. But I am an integrator not very coder ;) I installed your framework and followed the procedure of creating page admin. I then tried to integrate the data recorded on this page into the files of my theme by following the instructions on this page: http: //xboxframework.com/documentation/getting-started/create-fields-and-get -field gains /

The problem is that I get the value of the field, but preceded by “string (xx)”.

How to get only the value to integrate it in my code ? I did not find a sample page in the files.

Thank you for your comeback.

Hi Lenit23.

To get the value of any field use this code:

$xbox = Xbox::get( 'my-admin-page' ); $value = $xbox->get_field_value( 'default-logo' );

The actual value is in the $value variable.
You are getting “string (xx)” because you are probably using the var_dump() function. http://php.net/manual/fr/function.var-dump.php
Lenit23

Lenit23 Purchased

Hello, thank you for your quick reply With the echo function it works much better. Have a good day

by
by
by
by
by
by