joshcummingsdesign / wp-plugin-starter Goto Github PK
View Code? Open in Web Editor NEWA starter kit for building WordPress plugins.
License: GNU General Public License v2.0
A starter kit for building WordPress plugins.
License: GNU General Public License v2.0
Hi, I found your plugin is quite helpful and fast in creating plugin.
I got an issue, how do I make an ajax call? I've created plugin-name/includes/class-admin-ajax.php
and placed my wp_ajax_
hook there, but seems like the hook is not recognized yet.
class-admin-ajax.php
<?php
add_action('wp_ajax_test', 'test');
function test(){ die('yay'); }
javascript section
<script>
jQuery(document).ready(function ($) {
$('#submit').click(function () {
var url = ajaxurl + "?action=test";
$.get( url, function () {
});
})
})
</script>
Can you point out where are my mistakes?
Need to provide better documentation, for example you can override the view in the partials folder.
Add basic unit tests for developers.
Checkboxes currently are 100% width.
Hey when trying to install without modifying anything yet. I got this error.
Can't use function return value in write context in /wp-content/plugins/testimonials/includes/class-activator.php on line 15
and that line is if( empty (get_option($option_name)) )
what I have found is
https://stackoverflow.com/a/4328049/8260463
empty() needs to access the value by reference (in order to check whether that reference points to something that exists), and PHP before 5.5 didn't support references to temporary values returned from functions. I am on version 7.1 so this shouldn't be an issue.
PHP doesn't have concept of emptyness. Values that evaluate to false are empty, values that evaluate to true are non-empty.
Return value from the method always exists (even if you don't have return statement, return value exists and contains null).
From what I understand about get_option() it will return false if no option is set. so then empty(false) returns null and WordPress tries to use that.
so changing to if( !(get_option($option_name)) ) worked for me, not sure if that's the best solution
PSR standard. Also typo on line 45 of phpcs.xml, should be "require".
CMB2 provides a nice API for creating meta boxes. We have a "WordPress way" implementation here, but CMB2 has a lot more field types which would save us a lot of work here.
Spacing issue where concatenation dots are used.
Need to provide a method for validation and sanitization of input fields.
Like there is with the boilerplate.
Upon trying to use your generator, cloud flare gives an SSL error...
Use composer for PHP dependencies.
See grizzly deploy for an example on how to do this properly.
In class-admin.php
Plugin updater throws a PHP error in the admin.
Add front-end Ajax example to docs.
See grizzly-deploy for example.
See the plugin boilerplate for details.
Thanks, this starter plugin is very helpful. But i didn't find a way to remove hooks. Please provide an example if anyone have done this.
Kind regards,
Check spacing including in between concat dots.
Some frontend code will be powered by shortcodes or will be called in different hooks. Right now the render method is being called in the 'wp_footer' hook. This needs to be clearly documented.
If there are no db values, it shouldn't throw an error.
As a style, align property assignment in constructor functions.
It would be nice to have a system that runs tests and auto-deploys to the update server.
See gz-cookie-banner.
Use modern JS.
Should not have parenthesis.
See grizzly-deploy for example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.