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 | |
| /* 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
| <?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
| // 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 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
| <form id="contact-form" action="//formspree.io/[email protected]" method="post"> | |
| <input type="text" name="Name" placeholder="Name" required> | |
| <input type="email" name="Email" placeholder="Email" required> | |
| <textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea> | |
| <!-- CONFIG --> | |
| <input class="is-hidden" type="text" name="_gotcha"> | |
| <input type="hidden" name="_subject" value="Subject"> | |
| <input type="hidden" name="_cc" value="[email protected]"> | |
| <!-- /CONFIG --> | |
| <input class="submit" type="submit" value="Send"> |
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
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name domain.com; | |
| autoindex off; | |
| index index.php index.html; | |
| root /srv/www/domain.com/public; |
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 | |
| class BlogController extends Controller | |
| { | |
| /** | |
| * Posts | |
| * | |
| * @return void | |
| */ | |
| public function showPosts() |
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
| // Set the default timezone using a GMT offset | |
| $offset = -5; // GMT offset | |
| $is_DST = FALSE; // observing daylight savings? | |
| $timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York" | |
| date_default_timezone_set($timezone_name); |