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
// This JS file is loaded by the theme: | |
(function() { | |
// The button with the CSS class "get-support" loads the form. | |
jQuery('.get-support').on('click', load_support_form); | |
// The form is displayed in a div tag with the CSS class "support-form". | |
function load_support_form() { | |
jQuery.get('/wp-admin/admin-ajax.php?action=my_get_support') | |
.then(function(response) { |
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
/** | |
* Recursively searches the startObject for the given value. | |
* | |
* All matches are displayed in the browser console and stored in the global variable "gsResults" | |
* The function tries to simplify DOM element names by using their ID, when possible. | |
* | |
* Usage samples: | |
* | |
* globalSearch( document, 'someValue' ); // Search entire DOM document for the string value. | |
* globalSearch( document, '^start' ); // Simple regex search (function recognizes prefix/suffix patterns: "^..." or "...$"). |
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
use framework "Foundation" | |
use scripting additions | |
property NSString : a reference to current application's NSString | |
property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet | |
set fileType to ".md" | |
set prefUrl to "" | |
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
<?php | |
/** | |
******************************************************************************* | |
* MAL: Maintenance Auto-Login. | |
******************************************************************************* | |
* Automatically logs you in as the first admin user found in the WordPress | |
* database. | |
* | |
* How to use it: | |
* |
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 | |
/** | |
* How to use this snippet: | |
* | |
* 1. Click the "Download ZIP" button (top-right area) | |
* 2. Open wp-admin > Plugins > Add New | |
* 3. Click "Upload Plugin" and select the zip file | |
* 4. After uploading the zip file, activate the plugin | |
* | |
* ---------- |
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 | |
/** | |
* Custom Block to output Code. | |
*/ | |
namespace MailPoet\Newsletter\Renderer\Blocks; | |
// Exit if accessed directly. | |
defined( 'ABSPATH' ) || exit; |
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 | |
/** | |
* Generate a random discount code that matches the given criteria. | |
* | |
* Samples: | |
* - generate_discount( 10, 'percent', '+7days', 'HI-^^^^' ); | |
* - generate_discount( 5, 'flat', '', '********' ); | |
* | |
* @param int $amount The discount code value. | |
* @param string $type The type, either [flat|percent]. |
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 | |
// https://stackoverflow.com/a/6041773/313501#answer-6041773 | |
function test1( $value ) { | |
if ( ! is_scalar( $value ) ) { | |
return null; | |
} | |
json_decode( $value ); | |
return ( json_last_error() == JSON_ERROR_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
<script> | |
setTimeout(function () { | |
DiviArea.show('contact'); | |
}, 5000); | |
</script> |
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
<script> | |
(function () { | |
// TODO: Adjust the following two lines: | |
var popup = 'contact'; // Your Popup ID. | |
var delay = 5; // Delay [in seconds]. | |
setTimeout(function () { | |
DiviArea.show(popup); | |
}, delay * 1000); |
NewerOlder