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 / 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 / console.save.js
Created December 24, 2021 22:48
Save data from DevTools console to a JSON file with console.save()
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data');
return;
}
if(!filename) filename = 'console.json';
@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-remove-single-entry-page-sections.php
Last active February 10, 2021 19:24
WPForms: hide certain sections on a single entry page: notes, log, debug, meta, payment, actions, related, geolocation.
<?php
/**
* This code removes all sections on a single entry page in the admin area.
* Methods names in the remove_action() function call are self explanatory.
* Comment out or remove those lines which sections you want to show.
*/
// Main content area.
add_action( 'wpforms_entry_details_content', static function ( $entry, $form_data, $single_entry ) {
@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;
}
@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;
} );
@slaFFik
slaFFik / wpforms-field-description-notification-emails.php
Last active November 23, 2020 20:31
WPForms: add field description in notification HTML and plain text emails
<?php
// HTML Email.
add_filter( 'wpforms_html_field_value', static function ( $field_val, $field, $form_data, $context ) {
if ( $context !== 'email-html' ) {
return $field_val;
}
if ( empty( $form_data['fields'][ $field['id'] ] ) ) {
@slaFFik
slaFFik / wpforms-new-smarttags-submitted-cpt.php
Last active February 14, 2020 19:09
WPForms: add several new smart tags for newly submitted CPT: ID, title and URL. Useful only for Post Submission addon.
<?php
function wpf_dev_register_smarttag( $tags ) {
// Key is the tag, value is the tag name.
$tags['submitted_cpt_id'] = 'Submitted Post Type ID';
$tags['submitted_cpt_url'] = 'Submitted Post Type URL';
$tags['submitted_cpt_title'] = 'Submitted Post Type Title';
return $tags;
@slaFFik
slaFFik / wp-mail-smtp-authtype-login.php
Created February 5, 2020 09:47
WP Mail SMTP: specify an exact AuthType to connect to a Server.
<?php
add_filter( 'wp_mail_smtp_custom_options', function( $phpmailer ) {
$phpmailer->AuthType = 'LOGIN';
return $phpmailer;
} );