Skip to content

Instantly share code, notes, and snippets.

View slaFFik's full-sized avatar
🚀

Slava Abakumov slaFFik

🚀
View GitHub Profile
@slaFFik
slaFFik / experiment.html
Created March 1, 2024 14:18
Ollie: an experiment with a nice design.
<!-- wp:group {"align":"wide","style":{"spacing":{"blockGap":"var:preset|spacing|small"}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|small"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:heading {"level":3,"fontSize":"base"} -->
<h3 class="wp-block-heading has-base-font-size"><strong>Features that scale with you</strong></h3>
<!-- /wp:heading -->
<!-- wp:paragraph {"fontSize":"x-small"} -->
<p class="has-x-small-font-size">We build professional-grade features that grow<br>with you as you scale your business.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
@slaFFik
slaFFik / wpforms-add-bcc-to-emails.php
Created October 16, 2017 15:49
WPForms: add BCC email header to notification emails
<?php
add_filter( 'wpforms_email_headers', function ( $headers, $emails ) {
// APPLY THE BCC TO THIS FORM ID ONLY.
// CHANGE THE ID TO THE FORM YOU NEED. OR REMOVE THE WHOLE IF BLOCK IF NEEDED FOR ALL FORMS.
if ( 384 !== $emails->form_data['id'] ) {
return $headers;
}
// CHANGE THIS EMAIL ADDRESS TO YOURS:
@slaFFik
slaFFik / wpms-smtp-disable-ssl-verify.php
Last active January 23, 2024 18:35
WP Mail SMTP: when using SMTP mailer - disable SSL verify on PHP 5.6+
<?php
add_filter('wp_mail_smtp_custom_options', function( $phpmailer ) {
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
@slaFFik
slaFFik / bulk-transfer-gh-issues.sh
Created October 14, 2023 20:32
Open local repo to bulk transfer all its issues to a new repo: https://jloh.co/posts/bulk-migrate-issues-github-cli/
gh issue list -s all -L 500 --json number | \
jq -r '.[] | .number' | \
xargs -I% gh issue transfer % https://github.com/<destination repo>
@slaFFik
slaFFik / wpforms-hide-forms-on-mobile.php
Created September 25, 2017 13:38
WPForms: Hide forms on mobile
<?php
add_filter( 'wpforms_frontend_load', function( $load, $form_data, $var ) {
// Comment these lines if you need to hide a certain form only.
if ( wp_is_mobile() ) {
return false;
}
// Or check certain form only. Uncomment.
/*
@slaFFik
slaFFik / wpforms-display-form-under-confirmation.php
Created February 22, 2021 15:24
WPForms: display a form under the confirmation message with or without user entered field values.
<?php
add_action(
'wpforms_frontend_output_success',
static function ( $form_data, $fields, $entry_id ) {
unset(
$_GET['wpforms_return'],
$_POST['wpforms']['id']
);
@slaFFik
slaFFik / wpforms-merge-field-values.php
Created January 23, 2020 14:06
WPForms: merge values for 2 fields into a 3rd one
<?php
add_filter( 'wpforms_entry_save_data', static function ( $fields, $entry, $form_data ) {
$value1 = '';
$value2 = '';
// These are field IDs to take data from, and to merge into.
$field1_id = 1;
$field2_id = 2;
@slaFFik
slaFFik / wpforms-new-smarttag-current-time.php
Last active February 3, 2023 15:01
WPForms: new smart tag - current date and time, also Unix timestamp
<?php
// Register the smart tag.
add_filter( 'wpforms_smart_tags', static function( $tags ) {
// Key is the tag, value is the tag name.
$tags['current_time'] = 'Current Date/Time';
return $tags;
} );
<?php
add_filter( 'wpforms_currencies', function( $currencies ) {
$currencies['RON'] = array(
'name' => __( 'Romanian Leu', 'wpforms' ),
'symbol' => ' lei',
'symbol_pos' => 'right',
'thousands_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
@slaFFik
slaFFik / expose.php
Created January 31, 2021 19:27
Fix Expose by BeyondCode issues when working with the local WordPress site
<?php
// phpcs:ignoreFile
define( 'EXPOSED_DOMAIN', 'example.sharedwithexpose.com' );
// Load only if we are running under Expose.
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || $_SERVER['HTTP_X_ORIGINAL_HOST'] !== EXPOSED_DOMAIN ) {
return;
}