I am a wordpress theme developer for over 3 years now, but I always fall back to your videos when I dont know what I am doing haha! Thanks for the awesome tutorials.
Haha no thank you. I have learned how to make templates by watching your turorials. I have my own company now. And that is all becouse of you. If i did not find your channel, i maybe would never have learned how to make templates and start the business. So thank you. (Sorry for the english haha i am dutch)
Wow, that's an awesome story, I'm sure my tutorials helped, but opening your own company was 99% because of you and your commitment, amazing achievement! :D
I thought that part 5 would be online about next week, but surprise, surprise: Boom, there it is!! THX, Alessandro!! You make learning WP a lot of fun!! ;-)
Priceless content! Bravo! I have paid for 2 different courses but finally found the best for free. Amazing! Wish you earn multiple times more, than other authors, who charge for their courses!
Since I started to encode wordpress themes so I waited a series of tutorials about options for a theme, and the rest of tutorials wait. A big plus these tutorials, thank you very much.
You rock! You saved my life with these informative videos. Ive spent much time with php learning procedural code and working up to oop extending classes and using SQL to make custom queries. This was the missing element. Huge Fan!
Alessandro, again a briliant tut! I've run into some issues with saving (lesson 4) but I guess I need to learn to write properly :-). Thanks again, I can't wait until the next episode. Please remember, you can sleep when you're old and retired ;-)
I can't thank you enough. This is helping me alot... I spent many days reading the documentation but I never got enough. Thank you. I can create better websites now.
+Valentin Scarevnea We're gonna stay on the admin panel a little bit more, to add more advanced functionalities, before jumping on the front end. Happy Coding!
Hey Alex, there has been a lot of updates during these last few years since you've made this series! It'd be great if you create another series of tutorial on WordPress theme development for beginners. Would appreciate that very much. This series helped me out to get started with a very base knowledge on WP development. Now, it'd be great if you had brought another series of tutorial with good explanations. Thanks!
this si awesome i enjoying my coding with you. learn alot from WP 101 series. you just change one word str_replace('super cooool', 'happy coding', $output) hahahahah thank you sooo mcuh for teaching us.
Great tutorials, I'm learning lots. I'm curious in which tutorial will you learn how to output this information? So for example, it would be great to use the Twitter handler on a hyperlink Twitter icon. I've made some additional boxes, such as a telephone number, email address and I'm looking forward how to output this information on the front end. Which tutorial would I need to review to find this out please?
All the info saved in the back-end will be outputted in the video about the sidebar, where I explain how to create a custom widget and print all the data in it. I suggest you to not skip any video tho. I follow a linear process of creating the back-end first, and then managing the front-end. Happy Coding!
Hey Alessandro, is this method the same to strip specific user input from the customizer api instead? for example a setting to change font size, to remove px or em from the users input?
I'll always recommend to build a custom template as you'll gain knowledge, improve your skills, and have full control on the code and the output. Editing a pre-built template will always give you headaches as you don't know how it was originally setup and how easy is to tweak the code.
Alessandro, excellent tutorial. I have a doubt. I need display a data wich I saved in inputs that I created. How I would do? I need to do some select or for each or there is a way easier?
We're generating all the input fields dynamically with WordPress methods. As you can see, we define the fields and register the settings, then we print those settings with a wordpress method, and the form is there for us without the necessity of writing the entire html.
Hi, in the previous video add_action('admin_init', sunset_custom_settings) was inside sunset_add_admin_page() function, and you mentioned the benefit of it. However in this video it is outside of the function. Was that intentional?
I am newbie in wordpress but this video help me a lot. #Alessandro Castellani do you have any plan to make any tutorial about Wordpress Plugin Development, PHP and object oriented PHP . Plz do it for us . Thanks , God bless you.
+yasin faruk Hi, thanks for following. Yes, after this series I will do a Plugin and Widget development series. I'm thinking to start also a PHP101 for beginners. I'll do that sooner or later.
hi alessandro i am pleased with your guidance , i want to learn two things can you please make it so 1st is getting in javascript jquery and angular js, 2nd is i want to learn proper way to create directories in wordpress according me eg like change structure of root files and change name of wp-content wp-admin according to my wish and so on so as to make my wordpress website more secure and not hackable easily.
Hi, thanks for watching! I'm planning to do a series about jquery, javascript, and angularjs, so sooner or later you will see those videos on my channel. About your request, I advice you to not do anything like that. You shouldn't touch the source code of WordPress other than inside your theme folder. WordPress is pretty secure by default, and if you change the basic folder structure you will end up destroying it and making it unusable. Don't use a framework or a CMS if you're not planning to respect its structure and logic. You can always build something custom from scratch in PHP. Happy Coding!
I got one quick question if you have a few minutes. I have an advanced custom field title, which I would like to turn into a URL automatically for the ID of that section. Do you know how to turn text into a URL?
Isn't there some other option than calling function for every custom field? What if we have 15/20 fields? It's just seems messy :) Maybe something like array?
Yes, absolutely. WordPress has a pretty awesome serializing function to save multiple options in the db. I will do a video on how to optimize the entire admin section later on. It's a bit advanced and I didn't want to create confusion before learning the basics
Hi Alex, thank you so much for your brilliant work! I get stuck with saving the values in the fields. If I fill all fields and click 'Save Changes', it saves only my First Name and the rest of the fields have a placeholder. I've already checked my spelling and all variable names but still do not find a problem. Do you have a clue what I could miss?
Hi Alex, i can't add section via add_settings_section() in admin profile page, i write add_settings_section('garage-profile-sidebar', 'Sidebar Options', 'garage_profile_sidebar_options', 'profile.php'); maybe you know what i need to write in $page = "???" ?
why i do this way when i can use custom fields in posts to do that? just do cat for social media every icon add in custom field and so that link am i wrong? i am wp beginner developer just need to learn right.
I showed in the tutorial how to use a callback function when registering settings. In the case of the Twitter field I'm sanitizing the input and removing the @ symbol before it gets stored in the DB
You could use a PHP template for sure, not HTML. It depends on how you prefer to manage your code, but then you will end up with 20+ files with a single input each. I prefer to keep everything in one place, when the function is short.
How did you solve it? I have same issue and trying to figure it out now. so far, if I delete my name the placeholder text appears but if I save that, the placeholder text goes away again.
Hi Giulio, thank you for your response.I figured it out, tried to find this post to update but could not until I saw your reply notification. Anyhoo...I was using notepad++ text editor and had spaces between the single quote and double quote characters and that was the cause. I hope this helps somebody else. Thank you again!
Hi aless! thank you for the tutorial.... ive learned a lot.. :) but i have a problem on sanitizing on twitter handler... when i saved the twitter handler to the wordpress... the twitter handler textbox gets empty even without a special character. Here is my code... register_setting('sunset-settings-group', 'twitter_handler', 'sunset_sanitize_twitter_handler' ); function sunset_sanitize_twitter_handler ( $input) { $ouput = sanitize_text_field($input); $output = str_replace('@', ' ', $output); return $output; } please help.. thanks alessandro!
I am a wordpress theme developer for over 3 years now, but I always fall back to your videos when I dont know what I am doing haha! Thanks for the awesome tutorials.
Oh wow, thank you so much for the trust :D
Haha no thank you. I have learned how to make templates by watching your turorials. I have my own company now. And that is all becouse of you. If i did not find your channel, i maybe would never have learned how to make templates and start the business. So thank you. (Sorry for the english haha i am dutch)
Wow, that's an awesome story, I'm sure my tutorials helped, but opening your own company was 99% because of you and your commitment, amazing achievement! :D
@@alecaddd I remember 2 years ago with my empty mind I watched your video. I learned from you. You are awesome. Yes Alecaddd you are great.
I thought that part 5 would be online about next week, but surprise, surprise: Boom, there it is!! THX, Alessandro!! You make learning WP a lot of fun!! ;-)
+CyberIllusions I didn't sleep, climbed a mountain and killed a dragon, just to do this tutorial a week in advance. And all for you :P
Priceless content! Bravo! I have paid for 2 different courses but finally found the best for free. Amazing! Wish you earn multiple times more, than other authors, who charge for their courses!
Since I started to encode wordpress themes so I waited a series of tutorials about options for a theme, and the rest of tutorials wait. A big plus these tutorials, thank you very much.
+Bucur Ion Niculae Thank you for following, I'm glad these tutorials are helpful for you.
Happy Coding!
You rock!
You saved my life with these informative videos. Ive spent much time with php learning procedural code and working up to oop extending classes and using SQL to make custom queries. This was the missing element. Huge Fan!
+Mark Grover Thank you so much for this nice comment, I'm really happy to hear that.
Happy Coding!
Alessandro, again a briliant tut! I've run into some issues with saving (lesson 4) but I guess I need to learn to write properly :-). Thanks again, I can't wait until the next episode.
Please remember, you can sleep when you're old and retired ;-)
+fam Schrikkema And what if I already consider myself old? Can I sleep now? Please?! >_>
thank you for the videos, for your time, for the effort and for helping us,
you are awesome
+Mohamed Hak Happy to hear that. Thank you so much for following!
These tutorials is simply amazing. Thank you.
Thank you so much
I can't thank you enough. This is helping me alot... I spent many days reading the documentation but I never got enough. Thank you. I can create better websites now.
Happy to be helpful!
eagerly waiting to see Redux Framework Tuto.. BTW, It's rocking.
attesa per il prossimo capitolo della serie . alex grande maestro.
+Jose Rafael Rojas B. Dude, that's perfect Italian.
Anyway, you sent me this comment in the exact moment a hit the "Publish" button. Part 6 is up :D
Desperately awaiting for the next video...
Desperately trying to edit the next 2 videos in Blender. They should be available tomorrow, or Saturday
Thank you for sharing your knowledge #Alessandro, It is sensational, congratulations.
Thank you so much for watching :D
Nice, nice, really nice, hope you add in the next video, the output of this settings fields.
Thanks a lot really good video, really gooooooood, best.
+Valentin Scarevnea We're gonna stay on the admin panel a little bit more, to add more advanced functionalities, before jumping on the front end. Happy Coding!
Thanks Aless!
Thank you, this is great, it gives me some confidence that I never have.
Happy to hear that :D
Hey Alex, there has been a lot of updates during these last few years since you've made this series! It'd be great if you create another series of tutorial on WordPress theme development for beginners. Would appreciate that very much. This series helped me out to get started with a very base knowledge on WP development. Now, it'd be great if you had brought another series of tutorial with good explanations.
Thanks!
I just started a Gutenberg series. Once that's finished, I will start a new beginner series for WP 5+
Cheers
@@alecaddd Thanks a lot for your response. Glad to hear that! Eagerly waiting for the series. Thanks again!
this course is awesome ! Thanks a lot my brother !
You're very welcome
Thank you alessandro, you're awesome
I'm Lovin it . Keep Going
+Bader Rj I will :D
this si awesome i enjoying my coding with you. learn alot from WP 101 series. you just change one word str_replace('super cooool', 'happy coding', $output) hahahahah
thank you sooo mcuh for teaching us.
Thank you so much for this positive comment.
Happy Coding!
Thank you so much for this series #Alessandro! How would you go about using social media links instead of handlers?
You can let the use insert a URL and sanitize that. Is there something specific you're trying to achieve?
Thank you for responding. Yes, I’m using social media icons in the footer. These should link to the respective pages / sites.
Great tutorials, I'm learning lots. I'm curious in which tutorial will you learn how to output this information? So for example, it would be great to use the Twitter handler on a hyperlink Twitter icon.
I've made some additional boxes, such as a telephone number, email address and I'm looking forward how to output this information on the front end. Which tutorial would I need to review to find this out please?
All the info saved in the back-end will be outputted in the video about the sidebar, where I explain how to create a custom widget and print all the data in it.
I suggest you to not skip any video tho. I follow a linear process of creating the back-end first, and then managing the front-end.
Happy Coding!
so very useful ! tanx!
+Seyed Ali Mousavi Happy to hear that
Thank you, man!
You're welcome :D
Hey Alessandro, is this method the same to strip specific user input from the customizer api instead? for example a setting to change font size, to remove px or em from the users input?
I haven't had the chance to fully use the customizer API yet, but this method is standard PHP, so it's should work the same.
Cheers
Hi Alessandro, You are the best! Can you tell me which code editor is this? Thanks a lot!
In these tutorials I was using Panic Coda but I recently switched to VSCode
Thank you aless ❤️
Nice job thanks!👍
always thumbs up
For each register field do we need to create separate function? Can we wrote HTML inside add_settings_field() function?
Hello,
i like to ask 1 question?
its better to create a custom template or to use a prebuild template from themeforest or other website ?
thanks
I'll always recommend to build a custom template as you'll gain knowledge, improve your skills, and have full control on the code and the output.
Editing a pre-built template will always give you headaches as you don't know how it was originally setup and how easy is to tweak the code.
@@alecaddd thanks for your answer, i will try to make a custom template and to gain more knowledge :)
Alessandro, excellent tutorial.
I have a doubt. I need display a data wich I saved in inputs that I created. How I would do? I need to do some select or for each or there is a way easier?
Keep watching the tutorials to learn how to easily print your saved data in your front-end.
Cheers
Yes. I learned in minutes hehe thanks.
where is the $input came from? we can use html input as variable without specify? I'm kinda confused . BTW thank you so much for good videos.
We're generating all the input fields dynamically with WordPress methods.
As you can see, we define the fields and register the settings, then we print those settings with a wordpress method, and the form is there for us without the necessity of writing the entire html.
Hi, in the previous video add_action('admin_init', sunset_custom_settings) was inside sunset_add_admin_page() function, and you mentioned the benefit of it. However in this video it is outside of the function. Was that intentional?
Can we have single sanitization callback for multiple fields?
I am newbie in wordpress but this video help me a lot. #Alessandro Castellani do you have any plan to make any tutorial about Wordpress Plugin Development, PHP and object oriented PHP . Plz do it for us . Thanks , God bless you.
+yasin faruk Hi, thanks for following. Yes, after this series I will do a Plugin and Widget development series.
I'm thinking to start also a PHP101 for beginners. I'll do that sooner or later.
plz do PHP and advance PHP too.ty
Oh, yeah... PHP101 for beginners! Untill reading this message Avatar 2 was my most expected release :))
php 101 not created yet ?
hi alessandro i am pleased with your guidance , i want to learn two things can you please make it so 1st is getting in javascript jquery and angular js, 2nd is i want to learn proper way to create directories in wordpress according me eg like change structure of root files and change name of wp-content wp-admin according to my wish and so on so as to make my wordpress website more secure and not hackable easily.
Hi, thanks for watching!
I'm planning to do a series about jquery, javascript, and angularjs, so sooner or later you will see those videos on my channel.
About your request, I advice you to not do anything like that.
You shouldn't touch the source code of WordPress other than inside your theme folder.
WordPress is pretty secure by default, and if you change the basic folder structure you will end up destroying it and making it unusable.
Don't use a framework or a CMS if you're not planning to respect its structure and logic.
You can always build something custom from scratch in PHP.
Happy Coding!
I added some functions to don't repeat the code every time ^^, I pass the code if some1 want to re-use it :).
function register_settings( $group, $options = array() ) {
foreach ( $options as $option ) {
register_setting( $group, $option );
}
}
function sunset_custom_settings() {
$group = 'sunset-settings-group';
$options = [ 'first_name', 'last_name', 'facebook_handler', 'gplus_handler' ];
register_settings( $group, $options );
// To avoid multiple IF's, repeat register_setting with extra option
register_setting( 'sunset-settings-group', 'twitter_handler', 'sunset_sanitize_twitter_handler' );
add_settings_section( 'sunset-sidebar-options', 'Sidebar Options', 'sunset_sidebar_options', 'alecadd_sunset' );
$args = format_myArgs( 'first_name', 'text', 'First Name' );
add_settings_field( 'sidebar-name', 'First Name', 'sunset_sidebar_addField', 'alecadd_sunset', 'sunset-sidebar-options', $args );
$args = format_myArgs( 'last_name', 'text', 'Last Name' );
add_settings_field( 'sidebar-lastname', 'Last Name', 'sunset_sidebar_addField', 'alecadd_sunset', 'sunset-sidebar-options', $args );
$args = format_myArgs( 'twitter_handler', 'text', 'Twitter handler', 'Input your Twitter username without the @ character.' );
add_settings_field( 'sidebar-twitter', 'Twitter handler', 'sunset_sidebar_addField', 'alecadd_sunset', 'sunset-sidebar-options', $args );
$args = format_myArgs( 'facebook_handler', 'text', 'Facebook handler' );
add_settings_field( 'sidebar-facebook', 'Facebook handler', 'sunset_sidebar_addField', 'alecadd_sunset', 'sunset-sidebar-options', $args );
$args = format_myArgs( 'gplus_handler', 'text', 'Google+ handler' );
add_settings_field( 'sidebar-gplus', 'Google+ handler', 'sunset_sidebar_addField', 'alecadd_sunset', 'sunset-sidebar-options', $args );
}
function sunset_sidebar_options() {
echo 'Customize your Sidebar Information';
}
function format_myArgs( $name, $type, $placeholder, $desc = false ) {
return array(
'name' => $name,
'type' => $type,
'placeholder' => $placeholder,
'desc' => $desc
);
}
function sunset_sidebar_addField( $args ) {
$value = esc_attr( get_option( $args['name'] ) );
echo '
' . $args['desc'] . ' ';
}
// Sanitization settings
function sunset_sanitize_twitter_handler( $input ) {
$output = sanitize_text_field( $input );
$output = str_replace( '@', '', $output );
return $output;
}
Thanks Alecadd! :) I'm learning a lot!.
Thanks for sharing
Alessandro Castellani to you for teaching us!😁👍🏼🔝
I got one quick question if you have a few minutes. I have an advanced custom field title, which I would like to turn into a URL automatically for the ID of that section. Do you know how to turn text into a URL?
Turn text into URL? I'm not sure I understand what you mean
@@alecaddd I want a title to be automatically turned into a URL, I figured it out like this But thanks for getting back to me so quick!
Isn't there some other option than calling function for every custom field? What if we have 15/20 fields? It's just seems messy :) Maybe something like array?
Yes, absolutely. WordPress has a pretty awesome serializing function to save multiple options in the db. I will do a video on how to optimize the entire admin section later on. It's a bit advanced and I didn't want to create confusion before learning the basics
Great, will be checking that video for sure!
Hi Alex, thank you so much for your brilliant work!
I get stuck with saving the values in the fields. If I fill all fields and click 'Save Changes', it saves only my First Name and the rest of the fields have a placeholder. I've already checked my spelling and all variable names but still do not find a problem. Do you have a clue what I could miss?
I've just found an error, a typical spelling error :-) setting-group instead of settings-group.
Thanks anyway, you are awesome, keep going :)
I'm glad you found the issue, those micro spelling mistakes are the worst and I do them all the time :D
Happy Coding!
what code editor you use in this lesson video ? thanks, sorry for bad english.
Panic Coda
thanks dude :)
Hi Alex, i can't add section via add_settings_section() in admin profile page, i write add_settings_section('garage-profile-sidebar', 'Sidebar Options', 'garage_profile_sidebar_options', 'profile.php'); maybe you know what i need to write in $page = "???" ?
Check my source code on github if something doesn't work.
i'm wondering is it the part of wordpress theme ? why admin page ? there is already a admin page of wordpress
Alessandro Dude, lol. Great tuts, sir Dude.
How can I append a url to the username so that it becomes a link to the social media profile?
I noticed you’ve moved the do_action() outside of the sunset_add_admin_page() scope in this video, what’s the reason for this?
do_action()? At which minute you're referring to?
Apologies, add_action('admin_init', 'sunset_custom_settings') - It's clear in Part 4 (Please refer to my Part 4 comment)
NICE
Definitely nice :D
why i do this way when i can use custom fields in posts to do that?
just do cat for social media every icon add in custom field and so that link am i wrong?
i am wp beginner developer just need to learn right.
are the inputs supposed to be saved somewhere? cause I checked the database there are no input value thatI typed in.
They should be stored in the wp_options table with the unique meta_key we specified
Thanks for replying. I just found out my mistake. Actually it was a syntax error. That's why the settings were not saved.
Alex, this way, should we also sanitize first-name , last-name ?
+salman kashfy yes you can do it if you think you'll need to add that extra layer of safety
It would be nice if you give an update the code on Github...
+Bucur Ion Niculae Uh, I forgot to do that. Thanks for the reminder, now it's updated.
+Alessandro Castellani I look forward to the rest of the tutorials. thank you
ERROR: options.php could not found. this is error. plz pronlam solv this question
Check my source code on Github, probably you have some small typo somewhere.
What is the theme of Coda that you are using?
It's called Panic Palette, and you can find it on the official website of Coda
Thank you so much. You are awesome.!!
how do you modify data before it gets post to databse
I showed in the tutorial how to use a callback function when registering settings. In the case of the Twitter field I'm sanitizing the input and removing the @ symbol before it gets stored in the DB
Why not use an HTML template file instead of echoing out the fields.
You could use a PHP template for sure, not HTML. It depends on how you prefer to manage your code, but then you will end up with 20+ files with a single input each. I prefer to keep everything in one place, when the function is short.
+Alessandro Castellani I see, that makes sense. Thanks for the response.
Hi Alessandro,
Thanks For the tutorial I learn more about WordPress. :D
I entered the placeholder but the text does not appear in the input..why? WP 4.8.2
Solved :)
How did you solve it? I have same issue and trying to figure it out now. so far, if I delete my name the placeholder text appears but if I save that, the placeholder text goes away again.
Brett S now i don't remember but i suggest you to download the code and replace It or check for a typo.
Hi Giulio, thank you for your response.I figured it out, tried to find this post to update but could not until I saw your reply notification. Anyhoo...I was using notepad++ text editor and had spaces between the single quote and double quote characters and that was the cause. I hope this helps somebody else. Thank you again!
And a field for email-to-be-sent-to all the mail from the contact form, a custom contact form build ^_^
+Valentin Scarevnea Yup, this will come soon, into another page of the admin area, to manage the customization of the built-in contact form.
Hi aless! thank you for the tutorial.... ive learned a lot.. :)
but i have a problem on sanitizing on twitter handler...
when i saved the twitter handler to the wordpress... the twitter handler textbox gets empty even without a special character.
Here is my code...
register_setting('sunset-settings-group', 'twitter_handler', 'sunset_sanitize_twitter_handler' );
function sunset_sanitize_twitter_handler ( $input) {
$ouput = sanitize_text_field($input);
$output = str_replace('@', ' ', $output);
return $output;
}
please help.. thanks alessandro!
I suggest you to check my source code on Github and compare it with yours, just to see if you have some small typo
Visual Composer or page builder make it video to u???
if make it then link paste it.
I did a couple of video reviews about Elementor and Oxygen. Take a look at those.
Cheers