-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include Shortcodes / Image Size Inclusion / Single CPT Template Howto #418
Comments
It has been a while since I added a shortcode but always making sure you are starting with a basic shortcode and working back up to your more complicated one is what I would do to debug further. You don't need to worry about what is "best" for public vs admin. It is purely individual choice and makes no real difference. If you feel CPT is publci then throw it in public. |
Thanks for the feedback Devin. I managed to make the shortcode work as part of the public class. Do think it belongs there. Will need to tweak it a lot more. Also kind of large so perhaps it needs to go into its own file. But made it work. |
Hey. I also seek a way to organize things on boilerplate. When you build plugins, not everything can fit int 5-10 files. I was thinking of making a CTP class system (some people say its better) and breaking down the big files to smaller ones. |
Been reading some of the issues as I am building a projects portfolio plugin based on the WordPress Plugin Boilerplate. Devin mentioned a way to include shortcodes.. Another user also talked about it here.
I did more or less follow these instructions and adjusted my repo Ianua Projects. I moved the shortcode I made to the public class, adjusted the general class and loader too. Issue I had is that I could only use add_action in the main class and not
add_shortcode
as I got a count_error. Too few parameters I guess so I reverted to the way I added it before using an extra class to add the shortcode in the public class.If I would like to add another
add_image_size
function using an add_action, would I add it to the main class loading the function from the public class? That the best way?Two, should I move the custom post type to public class from the admin folder too? Seems like the best way and single cpts will definitely be public...
Three, was trying to figure out the proper way on adding a single cpt template or adjusting the display of the single post view it is loading without now. Found Slushman's now hiring plugin and mention of single template view code here. So digging some more there, but any tips / tuts are very welcome!
The text was updated successfully, but these errors were encountered: