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 | |
# Register custom post types on the 'init' hook. | |
add_action( 'init', 'my_register_post_types' ); | |
/** | |
* Registers post types needed by the plugin. | |
* | |
* @since 1.0.0 | |
* @access public |
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
//disable additional css | |
function remove_additional_css( $wp_customize ) { | |
$wp_customize->remove_section('custom_css'); | |
} | |
add_action('customize_register', 'remove_additional_css'); | |
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
# Magically copy your public key to a remote server and add it to authorized_keys with this handy one-liner. | |
# -i flag accepts the path to the file that will be uploaded. | |
# final argument is the username@host-destination root directory. | |
ssh-copy-id -i ~/.ssh/some-key.pub user@host.com | |
# To confirm the copy was successful (supposing you can recognize your public key when you see it) | |
ssh user@host.com && cat /.ssh/authorized_keys |
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
add_action('wp', 'test'); | |
function test() { | |
//get file modified time of style.css | |
$time = filemtime('./style.css'); | |
$msg = "style.css was modified at: " . $time; | |
$log_file = fopen(ABSPATH . '/theme_file_edit_logs.txt', 'a'); | |
fwrite($log_file, $msg); | |
fclose($log_file); | |
} |
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
#!/bin/bash | |
# Install SSH and Git | |
sudo apt-get update | |
sudo apt-get install -y openssh-server git | |
# Prompt user for email | |
read -p "Enter your email for SSH key generation: " email | |
# Generate SSH keys with different names and ed25519 algorithm |
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
-- display the current admin email | |
select * from wp_options where option_name = 'admin_email'; | |
--update admin email | |
update wp_options set option_value = 'newadmin@example.com' where option_name = 'admin_email'; |
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 | |
add_filter('wp_kses_allowed_html', 'acf_add_allowed_iframe_tag', 10, 2); | |
function acf_add_allowed_iframe_tag($tags, $context) { | |
if($context === 'acf') { | |
$tags['iframe'] = array( | |
'src' => true, | |
'height' => true, | |
'width' => true, | |
'frameborder' => true, |
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
<? | |
//prevent gravity forms submissions containing URLS | |
//filter hook 'gform_field_validation_1_12' identifies a Gravity Form with an ID of 1 and a Field ID of 12 | |
//second argument for the filter can be anything, it's just referencing the name of the function to run | |
add_filter( 'gform_field_validation_1_12', 'validate_input_1_12', 10, 4 ); | |
function validate_input_1_12( $result, $value, $form, $field ) { | |
$nourl_pattern = '(ftp|http|https|www|.com|.net|.org|.io|.biz|.info|.mil|.edu|.gov|.me|.int|FTP|HTTP|HTTPS|WWW|.COM|.NET|.ORG|.IO|.BIZ|.INFO|.MIL|.EDU|.GOV|.ME|.INT)'; | |
if (preg_match( $nourl_pattern, $value ) ) { |
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
#!/bin/bash | |
#update all the things | |
sudo apt update && | |
sudo apt upgrade -y && | |
#install all the dependencies |
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
<? | |
//load as ES6 | |
function load_as_ES6($tag, $handle, $source) { | |
if('tagname' === $handle) { | |
$tag = '<script src="' . $source . '" type="module" ></script>'; | |
} | |
return $tag; | |
} | |
add_filter('script_loader_tag', 'load_as_ES6', 10, 3); |
NewerOlder