WordPress Snippet
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 | |
| // Add the field to the Add New Category page | |
| add_action( 'category_add_form_fields', 'pt_taxonomy_add_new_meta_field', 10, 2 ); | |
| function pt_taxonomy_add_new_meta_field() { | |
| // this will add the custom meta field to the add new term page | |
| ?> | |
| <div class="form-field"> | |
| <label for="term_meta[cat_icon]"><?php _e( 'Font Awesome Icons', 'pt' ); ?></label> | |
| <input type="text" name="term_meta[cat_icon]" id="term_meta[cat_icon]" value=""> |
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
| // Remove Meta Generator: <meta name="generator" content="WordPress x.x" /> | |
| // and <meta name="generator" content="WooCommerce x.x.x" /> | |
| remove_action('wp_head', 'wp_generator'); | |
| // Remove the EditURI/RSD | |
| // Like: <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/wp/xmlrpc.php?rsd" /> | |
| remove_action ('wp_head', 'rsd_link'); | |
| // Remove it if you don't know what is Windows Live Writer | |
| // <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wp/wp-includes/wlwmanifest.xml" /> |
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 | |
| add_action( 'user_register', 'add_user_to_sendy_list' ); | |
| function add_user_to_sendy_list( $user_id ) { | |
| $list = 'SENDY_LIST_ID'; | |
| $url = 'http://SENDY_INSTALL_URL/subscribe'; | |
| $user = get_userdata( $user_id ); | |
| $email = $user->data->user_email; | |
| $name = $user->data->user_nicename; |
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 | |
| /* Dynamically add file attachments to Contact Form 7 emails from a Wordpress custom field. | |
| * Custom field is 'case-pdf' in the example. | |
| */ | |
| add_action('wpcf7_before_send_mail', 'wpcf7_add_attachment'); | |
| function wpcf7_add_attachment($contact_form) { | |
| global $_POST; | |
| $submission = WPCF7_Submission::get_instance(); |
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
| for i in `curl https://www.cloudflare.com/ips-v4`; do csf -a $i; done |
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 | |
| add_hook('AdminLogin', 1, function($vars) { | |
| $_SESSION["AuthConfirmationTimestamp"] = \Carbon\Carbon::now()->timestamp; | |
| }); | |
| add_hook('AdminAreaHeadOutput', 1, function($vars) { | |
| $_SESSION["AuthConfirmationTimestamp"] = \Carbon\Carbon::now()->timestamp; | |
| return ' | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ |
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
| sudo su | |
| //Setup Hostname | |
| hostnamectl set-hostname subdomain.domain.tld | |
| ## Basic | |
| sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get autoremove -y && sudo apt-get install software-properties-common | |
| //Setup SWAP | |
| sudo fallocate -l 1G /swapfile; | |
| ls -lh /swapfile; |
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
| /* ------------------------------------ | |
| /* CUSTOM FONTS | |
| /* ------------------------------------ */ | |
| /* ELEMENTOR */ | |
| function modify_controls( $controls_registry ) { | |
| // First we get the fonts setting of the font control | |
| $fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' ); | |
| // Then we append the custom font family in the list of the fonts we retrieved in the previous step | |
| $new_fonts = array_merge( [ 'Biotif' => 'system' ], $fonts ); |
This Gist shows how to add a sortable Views column to the post/page/custom-post-type edit screen.
Out of the box, the script will display the Views column on both the Posts and Pages screens. You can change that by editing the $post_types_with_views_column array at the beginning of the script.
- Using the text editor of your preference, create a file called
wpp-sortable-columns.phpand add the contents of this script to it. - Place the
wpp-sortable-columns.phpfile inwp-content\plugins.