This file contains hidden or 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 | |
| // Snippet code demonstrating how you could get a clean URL from a user supplied domain name | |
| // Include the function above with the test.php file to test a bunch of different urls to view the results | |
| function cleanURL($url) { | |
| // Remove http, https and trailing slashes from the url. | |
| $domainURL = str_ireplace('http://', '', $url); | |
| $domainURL = str_ireplace('https://', '', $domainURL); |
This file contains hidden or 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 | |
| // Snippet code demonstrating how you could potentially do domain/DNS verification checks in PHP. | |
| // Example: | |
| // In this example, we're looking at the domain www.islandmeetscity.com for a TXT record with the value kboZ2tg22FjOPUJQliMJ4QW5g. | |
| // The isDomainVerified function will return true/false if this record exists. | |
| $domainName = 'www.islandmeetscity.com'; | |
| $requiredTXTValue = 'kboZ2tg22FjOPUJQliMJ4QW5g'; |
This file contains hidden or 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 type="text/javascript"> | |
| // If you are using jQuery, you need to initialise the JS variable on your PHP page (ie index.php) so it can be globally accessed. | |
| $(function () { | |
| // Set CSRF token | |
| window.ajax_token = '<?php echo $token; ?>'; | |
| }); | |
| // Then in your AJAX function, you can use this variable inside your script.js file for example like so: |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # Get WordPress Featured Image from Post | |
| <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> | |
| #----------------------------------------------------- | |
| # Fix WordPress uploads files | |
| # | |
| # See: https://kinsta.com/knowledgebase/sorry-this-file-type-is-not-permitted-for-security-reasons/ | |
| # |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # Roots Sage WordPress Theme - Build | |
| composer install | |
| npm install | |
| npm run build | |
| # Run the following for production files: | |
| npm run build:production |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # WPBakery - Exclude Posts from Post Grid but have a category | |
| <?php | |
| require('wp-load.php'); | |
| $data = array( | |
| 'post_type' => 'post', | |
| 'post_status' => 'publish', |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # Send ping results to file: | |
| # On Mac: | |
| ping 172.16.229.39 | tee ~/Desktop/ping-results-172.16.229.39.txt | |
| # On Windows: | |
| ping 172.16.229.39 >> c:\Test.txt -t |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # PowerBuilder File Types: | |
| .pbd = compiled code | |
| .pbl = source code |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # Placeholder above Input on focus: | |
| <label> | |
| <input placeholder=" "> | |
| <span>Placeholder Text</span> | |
| </label> | |
| label { |
This file contains hidden or 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
| #----------------------------------------------------- | |
| # Abort an AJAX request: | |
| var xhr = false; | |
| function fetchEvents() { | |
| // Abort any existing AJAX request | |
| if (xhr) xhr.abort(); |
OlderNewer