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 | |
delete_option( '_wsvpro_settings' ); | |
// For site options in Multisite. | |
delete_site_option( '_wsvpro_settings' ); |
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 apiFetch from '@wordpress/api-fetch'; | |
// Define your WooCommerce consumer key and secret | |
const consumerKey = 'your_consumer_key'; | |
const consumerSecret = 'your_consumer_secret'; | |
const storeUrl = 'https://your-domain.com/wp-json/store-vacation/v1'; | |
// Function to fetch WooCommerce vacation schedules. | |
const fetchVacationSchedules = async () => { | |
try { |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
function useWindowDimensions() { | |
const [width, setWidth] = React.useState(window.innerWidth); | |
const [height, setHeight] = React.useState(window.innerHeight); | |
React.useEffect(() => { | |
const handleResize = () => { | |
setWidth(window.innerWidth); |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
function useWait(delay) { | |
const [status, setStatus] = React.useState(false); | |
React.useEffect(() => { | |
const id = window.setTimeout(() => { | |
setStatus((c) => !c); | |
}, delay); |
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
.wsvpro + .product form.cart { | |
display: none; | |
} |
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
// 1. Destructure the `subreddit` from props: | |
function Reddit({ subreddit }) { | |
const [posts, setPosts] = useState([]); | |
useEffect(() => { | |
async function fetchData() { | |
// 2. Use a template string to set the URL: | |
const res = await fetch( | |
`https://www.reddit.com/r/${subreddit}.json` | |
); |
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 React, { useEffect, useState, useRef } from "react"; | |
import ReactDOM from "react-dom"; | |
function App() { | |
// Store a reference to the input's DOM node | |
const inputRef = useRef(); | |
const [value, setValue] = useState(""); | |
useEffect( | |
() => { |
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 | |
/** | |
* Convert a float to a string without locale formatting which PHP adds when changing floats to strings. | |
* | |
* @param float $float Float value to format. | |
* @return string | |
*/ | |
function prefix_float_to_string( $float ) { | |
if ( ! is_float( $float ) ) { |
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 | |
/** | |
* Explode a string into an array by $delimiter and remove empty values. | |
* | |
* @param string $string String to convert. | |
* @param string $delimiter Delimiter, defaults to ','. | |
* @return array | |
*/ | |
function prefix_string_to_array( $string, $delimiter = ',' ) { |
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
<wpml-config> | |
<custom-fields> | |
<custom-field action="copy">quantity</custom-field> | |
<custom-field action="translate">custom-title</custom-field> | |
</custom-fields> | |
<custom-types> | |
<custom-type translate="1">book</custom-type> | |
<custom-type translate="1">DVD</custom-type> | |
</custom-types> | |
<taxonomies> |
NewerOlder