Write reusable PHP classes and functions, and use them in back-end code, front-end code and PHP shortcodes.
Your imagination is the limit!
Example code
A simple class to demonstrate library class usage.
Use class from back-end code
Please note that the code_manager_data_service class from this demo can also be used in front-end code and PHP shortcodes.
Result
Please try the following URLs to see the demo in action:
- https://code-manager.com/wp-admin/admin-ajax.php?action=code_manager_data_service_json (returns an associative array)
- https://code-manager.com/wp-admin/admin-ajax.php?action=code_manager_data_service_json&array_type=ARRAY_N (returns a numeric array)
- https://code-manager.com/wp-admin/admin-ajax.php?action=code_manager_data_service_json&table_name=abc (returns an error)
- https://code-manager.com/wp-admin/admin-ajax.php?action=code_manager_data_service_json&table_name=csv_demo_products (returns an associative array)