[http://codex.wordpress.org/Function_Reference/wp_localize_script] [http://stackoverflow.com/questions/6808221/php-within-js-file-wordpress]
<?php wp_localize_script( $handle, $name, $data ); ?>
<form name="myform" method="GET" action="<?php echo esc_url(home_url('/'));?>"> | |
<?php if (class_exists('WooCommerce')): ?> | |
<?php | |
if (isset($_REQUEST['product_cat']) && !empty($_REQUEST['product_cat'])) { | |
$optsetlect = $_REQUEST['product_cat']; | |
} else { | |
$optsetlect = 0; | |
} | |
$args = array( |
// 1) Get the customer... required the get the payment method token | |
await braintreeGateway.customer.find( | |
billing_customer_id, | |
async (err, customer) => { | |
await braintreeGateway.subscription.find( | |
subscriptionId, | |
async (err, subscription) => { | |
if (err) { | |
res.status(400).json({ | |
error_message: err && err.code |
# - DISMISS PUBLIC ACCESS; ONLY ALLOW API ACCESS VIA OWN DOMAIN | |
# - ALLOW ADMIN ACESS FOR ALL | |
# | |
# This example is in the "public_html/api/" folder where | |
# the WP API is installed. | |
# | |
RewriteEngine On | |
# If the referer is not its own domain | |
RewriteCond %{HTTP_REFERER} !^http?://architectura.com [NC] | |
# Then make it forbidden if not an admin login th |
<?php | |
add_filter('wpseo_pre_analysis_post_content', 'add_custom_to_yoast'); | |
function add_custom_to_yoast( $content ) { | |
global $post; | |
$pid = $post->ID; | |
$custom = get_post_custom($pid); //gets all custom fields in an arry of the current post/page | |
unset($custom['_yoast_wpseo_focuskw']); // Don't count the keyword in the Yoast field! |
<?php | |
/* | |
* Redirect Attachment Pages | |
*/ | |
add_action( 'template_redirect', 'wpse27119_template_redirect' ); | |
function wpse27119_template_redirect() | |
{ | |
// Get out of here if not headed to an attachment page | |
if( ! is_attachment() ) return; |
[http://codex.wordpress.org/Function_Reference/wp_localize_script] [http://stackoverflow.com/questions/6808221/php-within-js-file-wordpress]
<?php wp_localize_script( $handle, $name, $data ); ?>
import React, { useEffect, useRef, useState } from "react" | |
export const VisualViewport = ({ | |
as: Element = "div", | |
children, | |
style = {}, | |
...props | |
}) => { | |
const ref = useRef (null) |
div:before { | |
content: ""; | |
position: absolute; | |
background: -webkit-linear-gradient(350deg, rgba(49, 27, 146, .8) 35%, rgba(125, 38, 205, .75)); | |
background: linear-gradient(350deg, rgba(49, 27, 146, .8) 35%, rgba(125, 38, 205, .75)); | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
right: 0; |
// @see: https://jsben.ch/cQk7m | |
// NOTE: `+val === +val` is like isNaN(val) but much faster, esp in Chrome... | |
// `+val` will convert a string containing a number into a number | |
// const isNumeric = (val) => (val && val.length || typeof val === 'number') && (+val === +val); | |
const isNumeric = (val) => ((val?.length || typeof val === 'number') && (+val === +val)) && !isNaN(parseFloat(val)) | |
isNumeric(12345678912345678912); | |
isNumeric('2'); | |
isNumeric('-32.2'); |