dwp-guten.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. Plugin Name: DWP Plugin
  4. Plugin URI: https://wp.davidwindham.com
  5. Description: A Plugin to go with the DWP theme. Add custom fields and blocks to the Gutenberg editor.( Pairs with DWP Theme )
  6. Author: windhamdavid
  7. Text Domain: dwp-plugin
  8. Version: 0.4.0
  9. License: GNU General Public License v3
  10. License URI:http://www.gnu.org/licenses/gpl-3.0.html
  11. @package dwp_plugin
  12. GitHub Plugin URI: https://github.com/windhamdavid/dwp-plugin
  13. Gitea Plugin URI: https://code.davidawindham.com/david/dwp-plugin
  14. */
  15. defined( 'ABSPATH' ) or die( 'DIE' );
  16. add_action( 'enqueue_block_editor_assets', 'dwp_guten_enqueue' );
  17. function dwp_guten_script_register() {
  18. wp_register_script(
  19. 'dw-guten-js',
  20. plugins_url( 'dwp-guten.js', __FILE__ ),
  21. array( 'wp-rich-text' , 'wp-element', 'wp-block-editor')
  22. );
  23. }
  24. add_action( 'init', 'dwp_guten_script_register' );
  25. function dwp_guten_enqueue () {
  26. wp_enqueue_script( 'dwp-guten-js');
  27. }
  28. add_action( 'enqueue_block_editor_assets', 'dwp_guten_enqueue_assets' );
  29. include_once('dwp-metaboxes.php');
  30. function dwp_guten_enqueue_assets() {
  31. wp_enqueue_script(
  32. 'dwp-gutenberg-sidebar',
  33. plugins_url( 'build/index.js', __FILE__ ),
  34. array( 'wp-plugins', 'wp-edit-post', 'wp-element', 'wp-components', 'wp-data' )
  35. );
  36. }
  37. /* Updater */
  38. //require_once plugin_dir_path( __FILE__ ) . 'dwp-updater.php';
  39. /* Blocks */
  40. require_once plugin_dir_path( __FILE__ ) . 'dwp-blocks.php';