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 | |
| /** | |
| * Locking whole web with simple password form | |
| * ACF fields: | |
| * - string 'wiki_password' - from settings, password to validate against the input form viewer login form | |
| * - bool 'wiki_lock_site' - from settings, whether the site should be only accessible with password | |
| * - array 'wiki_allowed_posts' - from settings, relation filed returning an array of post IDs, which are allowed to be viewed without password | |
| */ |
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 | |
| /* | |
| * Plugin Name: ACFSyncFieldGroups | |
| * Plugin URI: https://gist.github.com/hirasso/c48c04def92f839f6264349a1be773b3 | |
| * Description: Allows to sync ACF field groups via WP CLI | |
| * Version: 0.0.2 | |
| * Author: Rasso Hilber | |
| * Author URI: https://rassohilber.com/ | |
| * License: GPL2+ | |
| * License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
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 | |
| function read_csv($file_path,$delimiter) { | |
| $csv_rows = array(); | |
| $fp = fopen($file_path, 'r'); | |
| $head = fgetcsv($fp, 4096, $delimiter, '"'); | |
| // Rows | |
| while($column = fgetcsv($fp, 4096, $delimiter, '"')) |
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 | |
| //In functions | |
| add_action( 'init', 'rewrite_plays_url' ); | |
| function rewrite_plays_url() { | |
| add_rewrite_rule( 'program/([^/]+)/([^/]+)/([^/]+)?$','index.php?page_id=1&rok=$matches[1]&mesic=$matches[2]&misto=$matches[3]', 'top' ); | |
| add_rewrite_rule( 'program/([^/]+)/([^/]+)?$','index.php?page_id=1&rok=$matches[1]&mesic=$matches[2]', 'top' ); | |
| add_rewrite_rule( 'program/([^/]+)?$','index.php?page_id=1&rok=$matches[1]', 'top' ); | |
| } | |
| add_filter( 'query_vars', 'register_custom_query_vars', 1 ); |
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 | |
| /** | |
| * Plugin Name: Lynt Admin | |
| * Author: Vladimir Smitka | |
| * Author URI: https://lynt.cz/ | |
| * License: GNU General Public License v3 or later | |
| * License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
| */ | |
| defined( 'ABSPATH' ) or die( 'nothing here' ); |
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 | |
| //Create an admin user | |
| function smartwp_create_admin_user(){ | |
| $username = 'yourusername'; | |
| $password = '2JyAEQJ9B9Jf5T8a'; | |
| $email = '[email protected]'; | |
| //This will ensure it only tries to create the user once (based on email/username) | |
| if ( !username_exists( $username ) && !email_exists( $email ) ) { | |
| $userid = wp_create_user( $username, $password, $email ); | |
| $user = new WP_User( $userid ); |
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
| <img data-src="unicorn.jpg" loading="lazy" alt=".." class="lazyload"/> | |
| <script> | |
| // Select all images with the class "lazyload" | |
| const images = document.querySelectorAll("img.lazyload"); | |
| // Check if the browser supports the "loading" attribute | |
| if ('loading' in HTMLImageElement.prototype) { | |
| // If so, we'll update all <img src> to point to the data-src instead | |
| images.forEach(img => { | |
| img.src = img.dataset.src; |
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 | |
| /** | |
| * Disable WordPress emojis | |
| * Source: https://kinsta.com/knowledgebase/disable-emojis-wordpress/#disable-emojis-code | |
| */ | |
| function disable_emojis() { | |
| remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
| remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
| remove_action( 'wp_print_styles', 'print_emoji_styles' ); |