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
import { addFilter, addAction } from '@wordpress/hooks'; | |
import {Button } from '@wordpress/components' | |
addFilter( 'WPTReactPluginTestButtonText', 'WPRactPluginTestHook', (arg )=>{ | |
return arg + ' Please' | |
}, 10 ) | |
addFilter( 'WPTReactPluginTestButtonText', 'WPRactPluginTestHook', (arg)=>{ | |
return arg + ' Here' | |
}, 9 ) |
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
import { render } from '@wordpress/element' | |
import domReady from '@wordpress/dom-ready'; | |
const App = () => { | |
return <>Welcome to WP react Tuts</> | |
} | |
domReady(function () { | |
if ('undefined' !== typeof document.getElementById('wp-react-plugin-test-app') && null !== document.getElementById('wp-react-plugin-test-app')) { | |
render(<App />, document.getElementById('wp-react-plugin-test-app')); |
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
<?php | |
/** | |
* Plugin Name: WP React Plugin Test Addon | |
* Plugin URI: https://racase.com.np/ | |
* Description: A test plugin addon to teach React on WordPress. | |
* Version: 1.0.0 | |
* Author: Rakesh Lawaju | |
* Author URI: https://racase.com.np/ | |
* Text Domain: wp-react-plugin-test | |
* Domain Path: /i18n/languages/ |
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
<?php | |
/** | |
* Plugin Name: WP React Plugin Test | |
* Plugin URI: https://racase.com.np/ | |
* Description: A test pluing to teach React on WordPress | |
* Version: 1.0.0 | |
* Author: Rakesh Lawaju | |
* Author URI: https://racase.com.np/ | |
* Text Domain: wp-react-plugin-test | |
* Domain Path: /i18n/languages/ |
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
const defaultConfig = require("@wordpress/scripts/config/webpack.config"); | |
const path = require('path'); | |
module.exports = { | |
...defaultConfig, | |
entry: { | |
'admin': [ | |
'./app/src/admin/index.js' |
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
function your_theme_admin_bar(){ | |
global $post; | |
if ( 231 === $post->ID ) { | |
return false; | |
} | |
} | |
add_filter( 'show_admin_bar' , 'your_theme_admin_bar'); |
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
function your_theme_admin_bar(){ | |
return false; | |
} | |
add_filter( 'show_admin_bar' , 'your_theme_admin_bar'); |
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
add_filter( 'show_admin_bar', '__return_false' ); |
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
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; | |
if (isIOS) { | |
console.log('This is a IOS device'); | |
} else { | |
console.log('This is Not a IOS device'); | |
} |
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
<form action="." method="post"> | |
<noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript> | |
<input | |
type="submit" | |
value="Pay with Card" | |
data-key="PUBLISHABLE STRIPE KEY" | |
data-amount="500" | |
data-currency="cad" | |
data-name="Example Company Inc" |