Hi alecad I watch your WordPress plugin development from scratch it is imagine but face some problems that video 0:57 line number 25, WordPress through error " can not access offset of type string on string" please guide me how to solve it
What do you mean by "getting rid of options saving"? I always recommend using the built-in database structure of WordPress, mostly because of scalability and compatibility with future versions, other themes or plugins. Having a custom table increases drastically the complexity and debt of your code.
This plugin I am creating is for only one website for one company and they want it on separate database tables. Now the admin checkboxes area or other settings might still be in the options table. I think I will look at your code on your git. They want to store student registration and scores or drew and such.
Hi Alessandro, Im developing my own plugin with your tutorials, I need to know if in the future we will see how the plugin visually interacts with the frontend, or we are just programming within the wp-admin, thanks.
Oh yeah, we're gonna code a lot of front-end stuff. Some of those are: - Custom widgets - Testimonial Contact Form - Custom Ajax Login - and other things I can't remember right now :D
Lots of people don't like Gutenberg unfortunately, eh eh. With this current setup, your custom post type should open the classic editor by default. Around the end of this series I showed how to activate Gutenberg by default for custom post types and custom taxonomies.
@@alecaddd Is that where you can add certain pieces of information to your post from somewhere else like the database? I'd like to store a dropdown of link names and address, key and value of my sources for articles. So I can just choose the correct source from sources I've used before. And update that list also. We do that through custom post types and custom taxonomies? Also something good to work at when wanting to find articles to post. Past sources.
hi alessandro, i have done everything as in tutorial but i receive an error in wordpress see here taht is only a cutout. why does it not accept the strings? i checked the code also with our repo but no failure? Warning: Illegal string offset 'post_type' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 227 Warning: Illegal string offset 'name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 230 Warning: Illegal string offset 'singular_name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 231 Warning: Illegal string offset 'menu_name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 232 Warning: Illegal string offset 'name_admin_bar' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 233 Warning: Illegal string offset 'archives' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 234 Warning: Illegal string offset 'attributes' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 235 Warning: Illegal string offset 'parent_item_colon' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 236 Warning: Illegal string offset 'all_items' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 237
If anyone is having the "register_post_type was called incorrectly" as i was having. I solved it by adding a small if statement at the method "storeCustomPostType()" . First you define the $option = get_option( 'YOUR OPTION NAME ' ); Then you wrap the entire $this->custom_post_types[] = array(); inside this if statement: if ( ! empty($option)) { // Enter the $this->custom_post_types[] here. } else { return; } I thought it was something about the 'title' => 'STRING' at the setFields -> 'post_type' being more than 20 characters. I tried fixing that but didn't help as my $option variable was never being set before a user types a custom post type so the $option['post_type'] was just being NULL, which i think was the problem. Anyway i am not yet quite sure why my if statement actually works and i'm not sure it will work for anyone else, anyway... Try it if you have the problem.
I get this error message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Inc\Base\CustomPostTypeController' does not have a method 'activate'
Hi, My code throws this error: Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.) in C:\wamp64\www\237First_wordpress\wp-includes\functions.php on line 4147 I hadn't any errors prior to this video. Any suggestions?
What's the name of the Post type are you trying to create? Check my source code on Github to see if you have any typos. Also, be sure to run PHP 7+ as I'm not 100% sure it'll work with PHP 5.6
Hi Alecad, Thanks for the great tutorial. I have a question. Is it possible to add custom fields to custom post types and have the user enter data in that field and include the information in that field while displaying custom post type in the archive page or other locations with the loop? Im not talking about the plugin, simply including this option by default for a specific post type in the theme. I cannot find such tutorials on youtube, however, many videos are there that use a plugin.
Hi, thanks for watching. Did you watch my Premium Theme development series? In those videos, I show how to create the Contact Custom Post Type, how to add some custom fields to it and allow the users to add data to those fields, all without the use of a plugin. Check that playlist and you'll learn everything you need.
hey Alee, great work! its little off topic but I need it to work. The IOS Toggle is not working on my side, copied files from your repo , changed the key and cert , gulp watch is working fine, everything looks good but it keeps showing those small checkboxes we did in the beginning.
Did you confirm that gulp is outputting the code correctly into assets/mystyle.js & assets/mystyle.css? if you open the files and scroll 4/5ths to the end in the mystyle.js you should see "ul.nav-tabs li.active" somewhere in the long line of code and go right to the end of .css and you should see "ui-toggle" a couple of times.
Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information.
Same issue here. Notice : register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information. (This message was added in version 4.2.) in XXXX\wp-includes\functions.php on line 3897 The error only appears when I didn't fill the form on the Custom Post Type Manager page.
Hi thank's for your videos! I just have a really important problem! Impossible to see the CPT on the menu and on the database. It is ok for the plugin but I don't see anny issue. I have spend two days on : I'm gonna be crazy ! This is the last repo if you have some time :( github.com/Djoulay/Wordpress-plugin Thank's (if you don't have time I totally understand!) Sorry for my English...
Hi, thanks for watching my videos. So, the CPT appears in the administration area and you're able to create and edit Post types? What does it mean it doesn't appear in the database? Can you check your wp_posts table and order by post_type column?
@@alecaddd thank's for your help! After 3 days.... I have found : "Do pay close attention to not having your custom post type identifier exceed 20 characters though, as the post_type column in the database is currently a VARCHAR field of that length." I have changed : public function storecpt() and public function registercpt() => it works ! Thank's for your help and very good job your my boss !! I just saw that there was the solution in your comments! I'll have to sleep and stop watching your great videos!
Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information.
What did you do to fix it? I looked through my code and couldn't find an issue so copied the code from github to be sure but I'm still getting the error.
hi dude, i got this error too, it was simple to resolve it : in the menu 'CPT Manager' (right below the Dashboard), the option 'Custom Post Type ID' was longer than 20 characters, i changed it, and now it works fine
@@julienm406 Thanks mate! You're a legend! I'm doing these again anyway to get a better grasp of what's going on so I'll remember that when I get to it :)
Hi alecad
I watch your WordPress plugin development from scratch it is imagine but face some problems that video 0:57 line number 25, WordPress through error " can not access offset of type string on string" please guide me how to solve it
You are amazing.After study Laravel , oop php for me very helpful use Wordpress such way with composer php package.Thanks very much.
I use Laravel every day :D
Implementing this approach in WordPress makes life soooo much easier when handling multiple methods and classes.
here we go!
All right!
I've made my own database tables for WordPress in the past. How are you start getting rid of options saving from all this code?
What do you mean by "getting rid of options saving"? I always recommend using the built-in database structure of WordPress, mostly because of scalability and compatibility with future versions, other themes or plugins. Having a custom table increases drastically the complexity and debt of your code.
This plugin I am creating is for only one website for one company and they want it on separate database tables. Now the admin checkboxes area or other settings might still be in the options table. I think I will look at your code on your git. They want to store student registration and scores or drew and such.
Hello! Great tutorial! you could do a totorial wordpress development + atomic design??? It's going to be really cool!
Good idea, I'll think about it for future series :D
Hi Alessandro, Im developing my own plugin with your tutorials,
I need to know if in the future we will see how the plugin visually interacts with the frontend, or we are just programming within the wp-admin, thanks.
Oh yeah, we're gonna code a lot of front-end stuff.
Some of those are:
- Custom widgets
- Testimonial Contact Form
- Custom Ajax Login
- and other things I can't remember right now :D
amazing man>>>
How would it change things by having Gutenberg editor? I don't like Gutenburg,
Lots of people don't like Gutenberg unfortunately, eh eh.
With this current setup, your custom post type should open the classic editor by default. Around the end of this series I showed how to activate Gutenberg by default for custom post types and custom taxonomies.
@@alecaddd Is that where you can add certain pieces of information to your post from somewhere else like the database? I'd like to store a dropdown of link names and address, key and value of my sources for articles. So I can just choose the correct source from sources I've used before. And update that list also. We do that through custom post types and custom taxonomies? Also something good to work at when wanting to find articles to post. Past sources.
hi alessandro, i have done everything as in tutorial but i receive an error in wordpress see here taht is only a cutout.
why does it not accept the strings? i checked the code also with our repo but no failure?
Warning: Illegal string offset 'post_type' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 227
Warning: Illegal string offset 'name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 230
Warning: Illegal string offset 'singular_name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 231
Warning: Illegal string offset 'menu_name' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 232
Warning: Illegal string offset 'name_admin_bar' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 233
Warning: Illegal string offset 'archives' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 234
Warning: Illegal string offset 'attributes' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 235
Warning: Illegal string offset 'parent_item_colon' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 236
Warning: Illegal string offset 'all_items' in C:\xampp\htdocs\wordpress\wp-content\plugins\ssl-soul-plugin\inc\Base\CustomPostTypeController.php on line 237
i found the failure with the array declaration
Cheers
If anyone is having the "register_post_type was called incorrectly" as i was having. I solved it by adding a small if statement at the method "storeCustomPostType()" .
First you define the $option = get_option( 'YOUR OPTION NAME ' );
Then you wrap the entire $this->custom_post_types[] = array(); inside this if statement:
if ( ! empty($option)) {
// Enter the $this->custom_post_types[] here.
} else {
return;
}
I thought it was something about the 'title' => 'STRING' at the setFields -> 'post_type' being more than 20 characters. I tried fixing that but didn't help as my $option variable was never being set before a user types a custom post type so the $option['post_type'] was just being NULL, which i think was the problem.
Anyway i am not yet quite sure why my if statement actually works and i'm not sure it will work for anyone else, anyway... Try it if you have the problem.
I get this error message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Inc\Base\CustomPostTypeController' does not have a method 'activate'
Check my source code on GitHub if you have any issues
Hi,
My code throws this error:
Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.) in C:\wamp64\www\237First_wordpress\wp-includes\functions.php on line 4147
I hadn't any errors prior to this video. Any suggestions?
What's the name of the Post type are you trying to create?
Check my source code on Github to see if you have any typos.
Also, be sure to run PHP 7+ as I'm not 100% sure it'll work with PHP 5.6
WOW Keep em coming...
Never stopping :D
Hi Alessandro, any idea why settings are registered twice when I click the Submit button? I have checked with you code and saw no difference!?
Uh, no idea, sorry. Did you try copying my code from GitHub?
Hi Alecad, Thanks for the great tutorial. I have a question. Is it possible to add custom fields to custom post types and have the user enter data in that field and include the information in that field while displaying custom post type in the archive page or other locations with the loop? Im not talking about the plugin, simply including this option by default for a specific post type in the theme. I cannot find such tutorials on youtube, however, many videos are there that use a plugin.
Hi, thanks for watching.
Did you watch my Premium Theme development series? In those videos, I show how to create the Contact Custom Post Type, how to add some custom fields to it and allow the users to add data to those fields, all without the use of a plugin.
Check that playlist and you'll learn everything you need.
I will look into that. Thanks alex
hey Alee, great work! its little off topic but I need it to work. The IOS Toggle is not working on my side, copied files from your repo , changed the key and cert , gulp watch is working fine, everything looks good but it keeps showing those small checkboxes we did in the beginning.
Try disabling caching. Are you using chrome?
@@sandro6691 cleared cache and tested on both firefox and mozila still same checkbox!
Did you confirm that gulp is outputting the code correctly into assets/mystyle.js & assets/mystyle.css?
if you open the files and scroll 4/5ths to the end in the mystyle.js you should see "ul.nav-tabs li.active" somewhere in the long line of code and go right to the end of .css and you should see "ui-toggle" a couple of times.
Yeah, be sure the compiled file is properly included in your admin page and it comes with all the custom classes we created.
Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information.
facing same issue
Undefined index: has_archive in ---> facing this problem
Hey now I have a problem that says ''register_post_type was called incorrectly''. This is creating problems and I'm having problem to move on.
Check my source code on GitHub if you have any problem.
Did that all. Tried to solve it through Google and other site. Still not working out. Really need help.
Same issue here.
Notice
: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see
Debugging in WordPress
for more information. (This message was added in version 4.2.) in XXXX\wp-includes\functions.php on line 3897
The error only appears when I didn't fill the form on the Custom Post Type Manager page.
Same error appears if you make the name too long. Needs an check to clear the error.
@@Reislust Was that a solution?? I don't get it. But Yeah I think that works.
Custom Post Type declaration may inspire an episode of Black Mirror.
What next lesson going to be??
+Rohan Kumar Sahu same topic, will be up on Monday
Hi thank's for your videos! I just have a really important problem! Impossible to see the CPT on the menu and on the database. It is ok for the plugin but I don't see anny issue.
I have spend two days on : I'm gonna be crazy !
This is the last repo if you have some time :( github.com/Djoulay/Wordpress-plugin
Thank's (if you don't have time I totally understand!)
Sorry for my English...
Hi, thanks for watching my videos.
So, the CPT appears in the administration area and you're able to create and edit Post types?
What does it mean it doesn't appear in the database?
Can you check your wp_posts table and order by post_type column?
@@alecaddd thank's for your help!
After 3 days....
I have found :
"Do pay close attention to not having your custom post type identifier exceed 20 characters though, as the post_type column in the database is currently a VARCHAR field of that length."
I have changed : public function storecpt() and public function registercpt() => it works !
Thank's for your help and very good job your my boss !!
I just saw that there was the solution in your comments! I'll have to sleep and stop watching your great videos!
anyone encounter Undefined index: has_archive or public or any other fields... go for the next video
wasted time trying to debug it lol
Notice: register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information.
Check my source code on GitHub to see if you have typos.
@@alecaddd. Ya the error is fix now. BTW your way of explanation is awesome. A man with lots of patience..
What did you do to fix it? I looked through my code and couldn't find an issue so copied the code from github to be sure but I'm still getting the error.
hi dude, i got this error too, it was simple to resolve it : in the menu 'CPT Manager' (right below the Dashboard), the option 'Custom Post Type ID' was longer than 20 characters, i changed it, and now it works fine
@@julienm406 Thanks mate! You're a legend! I'm doing these again anyway to get a better grasp of what's going on so I'll remember that when I get to it :)