The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
<?php | |
/* | |
* Add a hidden field to our WooCommerce login form - passing in the refering page URL | |
* Note: the input (hidden) field doesn't actually get created unless the user was directed | |
* to this page from a single product page | |
*/ | |
function redirect_user_back_to_product() { | |
// check for a referer | |
$referer = wp_get_referer(); | |
// if there was a referer.. |
const WordpressPurgeCSS = { | |
whitelist: [ | |
"rtl", | |
"home", | |
"blog", | |
"archive", | |
"date", | |
"error404", | |
"logged-in", | |
"admin-bar", |
/* Sets the user's display name (always) to first name last name, when it's available ************************************** | |
** http://stackoverflow.com/questions/9326315/wordpress-change-default-display-name-publicy-as-for-all-existing-users *** */ | |
/* !아이디 대신 이름으로 나타내기 ********************************************************************************************* */ | |
/* Sets the user's display name (always) to first name last name, when it's avail. */ | |
add_action ('admin_head','make_display_name_f_name_last_name'); | |
function make_display_name_f_name_last_name(){ | |
$users = get_users(array('fields'=>'all')); | |
foreach($users as $user){ | |
$user = get_userdata($user->ID); | |
$display_name = $user->first_name; |
lsof -n -i4TCP:5037 | grep LISTEN
kill -9
adb devices
<?php | |
$cmb->add_field( array( | |
'name' => __( 'Postive numbers', 'theme-domain' ), | |
'desc' => __( 'Numbers only', 'msft-newscenter' ), | |
'id' => $prefix . 'number', | |
'type' => 'text', | |
'attributes' => array( | |
'type' => 'number', | |
'pattern' => '\d*', |
{ | |
// Editor Functionalities | |
"diffEditor.renderSideBySide": false, | |
"editor.guides.bracketPairs": true, | |
"editor.bracketPairColorization.enabled": true, | |
"editor.cursorBlinking": "phase", | |
"editor.cursorSmoothCaretAnimation": false, | |
"editor.defaultFormatter": "esbenp.prettier-vscode", | |
"editor.fontFamily": "JetBrainsMono-Regular, JetBrains Mono Regular, OperatorMono-Book, Liga Roboto Mono, Menlo, Monaco", | |
"editor.fontLigatures": true, |
<?php | |
add_filter( | |
'ep_prepare_meta_data', | |
function ( $prepared_meta ) { | |
foreach ( $prepared_meta as $key => $meta_val ) { | |
// Remove empty meta fields. | |
if ( empty( $key ) || empty( $meta_val ) || empty( $meta_val[0] ) ) { | |
unset( $prepared_meta[ $key ] ); | |
continue; | |
} |
<?php | |
/** | |
* Adds Page to a WordPress navmenu | |
* @param [int] $page_id The ID of the page you want to add | |
* @param [str] $page_title Title of menu item | |
* @param [int] $menu_id NavMenu ID | |
* @param [int] $parent (Optional) Menu item Parent ID | |
*/ | |
function add_page_to_menu($page_id, $page_title, $menu_id, $parent = 0){ |
<?php | |
/** | |
* Detect if a WordPress plugin is active | |
* A function you can use to check if plugin is active/loaded for your plugins/themes | |
* @link //gist.github.com/llgruff/c5666bfeded5de69b1aa424aa80cc14f | |
*/ | |
// When coding plugins that rely on another one, like Private Content for bbPress or Visual Attributes for WooCommerce, you need to make if the WordPress Plugin is active to initialize your plugin routines or display a notice saying that the required plugin must be activated. In this tutorial we’ll see how to detect whether a certain plugin is active in a couple of ways. | |
## 1. Check whether a certain class or function or constant exists |