-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreactapp.php
More file actions
27 lines (22 loc) · 838 Bytes
/
reactapp.php
File metadata and controls
27 lines (22 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/*
Plugin Name: Dallas React App
Plugin URI: http://link to your plugin homepage
Description: Create a basic React app
Version: 1.0
Author: Giannis Dallas
Author URI: https://giannisdallas.com
License: GPL2 etc
License URI:
*/
//[foobar]
function foobar_func( $atts ){
return "<div id='reactApp'>This is a test</div>";
}
add_shortcode( 'foobar', 'foobar_func' );
function reactapp_enqueue_scripts() {
wp_enqueue_script( 'React-js', 'https://unpkg.com/react@16/umd/react.production.min.js', array(), '', true );
wp_enqueue_script( 'React-DOM', 'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js', array(), '', true );
wp_enqueue_script( 'custom-react-app', plugin_dir_url( __FILE__ ) . '/compiled/app.js', array(), '', true );
}
add_action( 'wp_enqueue_scripts', 'reactapp_enqueue_scripts' );