WordPress Plugin Development - Part 22 - Database Optimization

  Рет қаралды 21,114

Alessandro “Alecaddd” Castellani

Alessandro “Alecaddd” Castellani

Күн бұрын

:: Support Me ::
/ alecaddd
www.alecaddd.co...
amzn.to/2DsPZUn
Check out Elementor: bit.ly/2q10nRo
:: Join the Forum ::
forum.alecaddd...
GitHub Repo: bit.ly/2gvDHAJ
:: Tutorial Series ::
WordPress 101 - Create a theme from scratch: bit.ly/1RVHRLj
WordPress Premium Theme Development: bit.ly/1UM80mR
WordPress Mega Menu: bit.ly/2ucxSO4
Learn SASS from Scratch: bit.ly/220yzmZ
Design Factory: bit.ly/1X7Csaz
Affinity Designer: bit.ly/1X7CrDA
:: My Website ::
www.alecaddd.com/
:: Follow me on ::
Twitter: / alecaddd
Google+: bit.ly/1Y7sunz
Facebook: / alecadddpage

Пікірлер: 49
@MrColins710
@MrColins710 4 жыл бұрын
The best videos in youtube about WP Plugin development
@chriswilliams4852
@chriswilliams4852 6 жыл бұрын
Great video and I love this series! You forgot to mention a fourth method, which is to store the settings as in the database as JSON. Not only does it save space, but is readable and less fragile if manually updated. I used that method in a plugin that I was working on before i took this tutorial to get a better grasp on developing for wordpress and php in general.
@alecaddd
@alecaddd 6 жыл бұрын
Ah, thanks for the heads up, I completely forgot about it.
@WalidTouati91
@WalidTouati91 7 жыл бұрын
I was waiting for this to come up, Super exited to the new year, Happy New Year :)
@alecaddd
@alecaddd 7 жыл бұрын
You're very welcome :D
@scuraluis
@scuraluis 4 жыл бұрын
If you have any issue trying to check/uncheck the fields (like automatic all fields get saved) you should check your code, this issue means you have something wrong! I recommend checking his github repository.
@dansimoaica7702
@dansimoaica7702 7 жыл бұрын
Thank you, Alessandro! Happy New Year!
@alecaddd
@alecaddd 7 жыл бұрын
Happy new Year to you, Dan :D
@Debug_talks
@Debug_talks Жыл бұрын
i have made same but still in my database these all field data not visible. even when i use your github repo still same in wp_options there is ntg cpt_manager etc. kindly help me
@webprogramming2707
@webprogramming2707 7 жыл бұрын
Happy new year our teacher..... :) wish u much success... Cheers
@alecaddd
@alecaddd 7 жыл бұрын
Thank you so much, all the best to you too
@danicolaj
@danicolaj 5 жыл бұрын
For some reason the values get stored as string types, so "1" for checked, but they don't get stored when unchecked and I get an error message then for the missing entries when the menu is displayed. I can probably/hopefully find a way to avoid that error in output, but I'm wondering... In the video, the storage type is 'b' but the element looks exactly the same as mine (value="1"). What am I doing wrong? a:9:{s:11:"cpt_manager";s:1:"1";s:16:"taxonomy_manager";s:1:"1";s:12:"media_widget";s:1:"1";s: etc.
@danicolaj
@danicolaj 5 жыл бұрын
Ah, why is it that I need to post a question always before finding the answer on my own? It's like waiting an hour for the bus then lighting a smoke just so it comes right away! ;) I had delete the $this->callbacks --- sanitize call but hadn't changed it to $this->callbacks_mgr - so I guess it was not finding it and doing nothing... instead of passing through sanitize?
@manichaze53
@manichaze53 5 жыл бұрын
@@danicolaj Thank you for this. I had the exact same problem, for the exact same reason :)
@andykid14
@andykid14 5 жыл бұрын
Hi i am having the same problem and i don't understand the solution that you used. Can you briefly explain how??? Thanks
@rasimmmyilmaz
@rasimmmyilmaz 4 жыл бұрын
check box name and id attribute is different . Do we need define id or why its different then name
@shrijantripathi
@shrijantripathi 7 жыл бұрын
Happy new year bro 😊
@alecaddd
@alecaddd 7 жыл бұрын
+Neplease Programmer Happy new year to you!
@muhammadarslanafzal9681
@muhammadarslanafzal9681 4 жыл бұрын
hi everyone i am facing issue when storing array in db. The checkboxes which are checked are only save with on value and unchecked field are not save
@anijimjames-maurice9778
@anijimjames-maurice9778 10 ай бұрын
Been a while this question was asked but in case anyone ever comes across this problem, this was how I was able to fix it... Trace back to the SettingsApi.php, in the registerCustomFields() method, the wordpress function, register_setting(), no longer accepts the 'callback' property. The only way to pass a callback is to use an 'args' property (which is an array) with a 'sanitize_callback' property. I'm not sure if this is a change from Wordpress, but moving on.. Replace the register_setting line with this, register_setting($setting['option_group'], $setting['option_name'], isset($setting['args']) ? $setting['args'] : null); Notice how I replace the 'callback' with 'args', because that's where the callback is accepted... Now, in the Admin.php, go to the setSettings function and remove the 'callback' property in the inner array (remember, the callback/sanitize_callback is now inside an 'args' property), then replace it with... 'args' => array( 'sanitize_callback' => array($this->callbacks_mngr, 'checkboxSanitize') ) And that fixed it for me. You can check Wordpress docs for more information. Hope this helps :)
@SabbirAhmed-cm6hk
@SabbirAhmed-cm6hk 6 жыл бұрын
Hi bro, How can add the all plugin data to my custom tables can you help me with this?
@chunnaranong6499
@chunnaranong6499 4 жыл бұрын
I have been following the series and was good until now. At the end of this lesson 22, my output is different. I checked and checked, but could not find the difference. I am getting all managers set to on. All I could find is checkboxSanitize - what I do not understand is the callback comes from 'admin.php' in function 'setSettings()', but how did we get $input as the argument for function 'checkboxSanitise', in 'ManagerCallbacks'. Please advise. Incidentally, I went to lesson 23, after I cleared the database and reactivated the plugin, all setting were off. I set one and it was fine but on refresh, they are all 'on'!
@chunnaranong6499
@chunnaranong6499 4 жыл бұрын
I've followed the lessons and traced the origin of 'checkboxSanistise' to 'alecaddOptionsGroup' (renamed in lesson 19, and the argument ($this) is from [option_name] ie. cpt_manager, taxonomy_manager, ..., chat_manager. It makes sense now, but am still looking to find why every setting if 'on'/true!!
@chunnaranong6499
@chunnaranong6499 4 жыл бұрын
Found it!! My error in 'ManagerCallbacks.php' - the echo line at the end. Visually I missed it, but on doing a file compare, I found missing quote. Spotted it when I looked at inspector, where 'checked' was not created properly!
@toano1245
@toano1245 2 жыл бұрын
thanks a lot of, my bro
@MarvelousMaterial
@MarvelousMaterial 7 жыл бұрын
Hey Alessandro. Do you show how to enqueue files on front-end based on user preferences in admin in this video?
@alecaddd
@alecaddd 7 жыл бұрын
Not in this video, but I'll do it in this series
@patrick-dev
@patrick-dev 7 жыл бұрын
Happy New Year My Teacher , Please i'm sorry if my question is out of the lesson , but i need an answer , I want to know why the page that Contains Subpages can't be clickable , i Mean i have a parent page , when i want to show ot from the website , i can't but the subpages i can click on them and show theme as a pages .
@alecaddd
@alecaddd 7 жыл бұрын
Are you talking about the menu? If it's about the menu, take a look at my WordPress Mega Menu series, I explain everything you need in those videos.
@patrick-dev
@patrick-dev 7 жыл бұрын
Thanks you so much , Okey i'll take a look at it , Thanks Again Teacher Alessandro ;)
@abdulrafay1951
@abdulrafay1951 6 жыл бұрын
I'm facing a problem when I check any field and save it. Automatically every field gets checked.
@ylebrac
@ylebrac 6 жыл бұрын
Hello Abdul Rafay, I'm facing the same issue. Did you find the reason why ? What I have noticed is, the first time when there is no data in the wp-option table, and I check one checkbox and hit the save button, all checkboxes are checked, but then, when I uncheck some checkboxes, hit the save button, and refresh the page, all fields remain correctly checked !? Has Alessandro any idea about this behavior?
@ylebrac
@ylebrac 6 жыл бұрын
Actually, got the answer on the following episode (Part 23), thanks to Rob Starr :)
@dipakdhakal3008
@dipakdhakal3008 7 жыл бұрын
Hello, alecaddd i want to make a multiple repeatable fields with google font awesome icon with multiple fields type like text, text area, multiple select, image fields. how can i do this ??
@alecaddd
@alecaddd 7 жыл бұрын
That's a really specific question :P Did you follow all my WordPress tutorials? You should be able to do it by yourself with all the knowledge and methods I explained in my videos. Cheers
@animeshsahu9937
@animeshsahu9937 7 жыл бұрын
What ligature do you use in sublime text 3?
@alecaddd
@alecaddd 7 жыл бұрын
+Animesh Sahu Fira Code
@animeshsahu9937
@animeshsahu9937 7 жыл бұрын
Is it working on sublime? Please make a video like what you do for Microsoft visual studio code editor!
@alecaddd
@alecaddd 7 жыл бұрын
+Animesh Sahu I already did it: kzbin.info/www/bejne/hIDIdGSMbal7bZI
@sagocode
@sagocode 7 жыл бұрын
thanks for the video
@alecaddd
@alecaddd 7 жыл бұрын
You're welcome!
@sir_incognito
@sir_incognito 6 жыл бұрын
Thank you Alex!:)
@alecaddd
@alecaddd 6 жыл бұрын
You're very welcome
@WayneMcHugh
@WayneMcHugh 4 жыл бұрын
Alessandro, your tutorials are teaching me so much - thank you. I've not been able to follow step by step because my development environment is messy. Plus I am trying to understand and adjust as we go, so my code isn't a 100% duplication of yours. But it was 100% working to the end of #21. #22 requires a heap of changes before you can test, and the result of my test is "ERROR: options page not found." Sadly I had no backup copy at the end of #21, and undoing changes back to what I believe was #21 now returns this same error, when it was working. So I'm suddenly stuck in my tracks. My page displays correctly, but when I save, my sanitize function never gets called. therefore I'm thinking the problem is in the hook to the sanitize function, but the callback in setSettings() is set correctly. When I inspect the form it shows all the input name the way they should be. Are there any typical causes for this error using the setup you're using? I'm post back here if I find the cause, but in the meantime any possible clue or things to check would be greatly appreciated.
@WayneMcHugh
@WayneMcHugh 4 жыл бұрын
Sorted. In taking the array in SetSettings back to one entry I had made it a single array instead of an array in an array. But working beautifully and back on the rails. Thanks again for this great tutorial series - it is a great achievement!
@SabbirAhmed-cm6hk
@SabbirAhmed-cm6hk 6 жыл бұрын
my plugin couldn't save in database @Alecaddd . :(
@alecaddd
@alecaddd 6 жыл бұрын
Again, check my source code on GitHub
@SabbirAhmed-cm6hk
@SabbirAhmed-cm6hk 6 жыл бұрын
I checked it brother. @@alecaddd But I couldn't find any cpt_manager, taxonomy_manager, media_widget, gallery_manager, testimonial_manager etc in wp_options table.
@SabbirAhmed-cm6hk
@SabbirAhmed-cm6hk 6 жыл бұрын
Opps Sorry brother I didn't checked view all fields in database thats why I thought it can't save on database. Thanks :D
WordPress Plugin Development - Part 23 - Save Default Options on Activate
14:48
Alessandro “Alecaddd” Castellani
Рет қаралды 16 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
WordPress Plugin Development - Part 24 - Create Modular Plugin Sections
20:09
Alessandro “Alecaddd” Castellani
Рет қаралды 17 М.
WordPress Plugin Development - Part 14 - Modular Administration Page
25:28
Alessandro “Alecaddd” Castellani
Рет қаралды 44 М.
CLONE any WEBSITE using AI - Just Paste the URL!
12:34
Learning AI creator
Рет қаралды 206 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 63 МЛН
WordPress Plugin Development - Part 19 - Modular Callbacks
26:37
Alessandro “Alecaddd” Castellani
Рет қаралды 29 М.
Insane Theoretical Physics Discussion with ChatGPT and DeepSeek
4:59
Unzicker's Real Physics
Рет қаралды 20 М.
Kendrick Lamar's Apple Music Super Bowl Halftime Show
13:25
WordPress Plugin Development - Part 26a - Modular Custom Post Types
16:46
Alessandro “Alecaddd” Castellani
Рет қаралды 14 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН