Course Plugin
Handle the basics with this plugin.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/raulvs14/course-plugin/archive/refs/heads/master.zipPlugin file - [plugin-file].php
- Create header file using header requirements
- Create admin pages administration screens
- Create admin menu using:
- Create hook for the admin menu add_action
- Activate plugin
Custom Post Types - [type_slug].php
- Install Custom Post Type UI
- Create new post type:
- Type slug
- Plural Label
- Singular Label
- Public - False
- Has Archive - False
- Exclude From Search - True
- With Front - False
- Create cpt/[type_slug].php file
- Export the created cpt from CPT UI under Tools -> Get Code
- Add it to the file cpt/[type_slug].php
- Include this file under [plugin-file].php using include_once
- Remove custom post type from menu by setting show_in_menu to false in the [type_slug].php file
- Rename the function [plugin_short]register[type_slug]
Create custom database tables
- Create method in your [plugin-file].php [plugin_short]_create_plugin_tables:
- Create a method for plugin activation
- Register activation hook for plugin activation method
Shortcodes
-
Create custom shortcode by registering shortcode function with add_shortcode
-
Create function that will replace the shortcode
-
Register hooks for shortcode using init
Add JS and CSS
Create functions that will:
-
Register the scripts and styles
-
Queue the scripts and styles
-
Create hooks
-
Ajax save response - create script and register hooks
-
Handling AJAX responses Nonce
Create custom admin columns
-
Create custom admin columns function and register it as a filter Add filter
Create admin page for statistics
- Create ajax functions for admin HTML and register
- Create function for HTML
- Create event listener for stats page
Create admin use
- Update page html and create function for db query for preview statistics
ISSUES
- Forgot password -> create md5 password and copy it to replace it in database
- Can't update -> check rights if the files are for correct user
- Can't connect to database:
- Grant privileges
mysql > grant all privileges on . to 'root'@'IP' identified by 'root_password'; mysql> flush privileges; - For IDE database connection: add UTC, when you get timezone error
- Test remote connection:
mysql -u <username> -h <ip_address_of_the_machine_having_mysql_server> -p <port_number> -p
- Grant privileges
- Does not send mail -> logout and try to send mail, it will give mail() error
- sudo apt-get install sendmail
- sudo sendmailconfig - choose "Yes"
- sudo service apache2 restart