Skip to content

Commit

Permalink
Setting Page Code Added
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi authored Mar 11, 2019
1 parent b154dd4 commit 2326d3e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions setting-page.php
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' );
}

0 comments on commit 2326d3e

Please sign in to comment.