-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b154dd4
commit 2326d3e
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* WordPress Setting Page for a React. | ||
* | ||
* @package WordPress | ||
* @since 1.0.0 | ||
*/ | ||
|
||
//_____________________Combining ReactJS & WordPress | ||
|
||
|
||
// Action to add menu in settings page. | ||
add_action( 'admin_menu', 'wpreact_admin_menu' ); | ||
|
||
/** | ||
* Function to add new menu in settings for Bricks | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
function wpreact_admin_menu() { | ||
add_options_page( | ||
__( 'React Page', 'wpreact' ), | ||
__( 'React Page', 'wpreact' ), | ||
'manage_options', | ||
'wpreact-page', | ||
'display_wpreact_admin_page' | ||
); | ||
} | ||
|
||
/** | ||
* Callback function of Bricks Setting Page - Render the settings page for the Bricks listing. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
function display_wpreact_admin_page() { | ||
?> | ||
<h1>Welcome..!</h1><br /> | ||
<div id="root" style="border: 1px solid red; padding : 25px; width: 800px;">This is 'root' div.</div> | ||
<?php | ||
} | ||
|
||
// Action to add scripts to admin side. | ||
add_action( 'admin_enqueue_scripts', 'wpreact_enqueue_admin_scripts' ); | ||
|
||
/** | ||
* Function to add the scripts and styles to admin page. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
function wpreact_enqueue_admin_scripts() { | ||
wp_enqueue_script( 'wpreact-script', get_stylesheet_directory_uri() . '/dist/bundle.js', array( | ||
'jquery', | ||
'wp-element' | ||
), '1.0.1' ); | ||
} | ||
|