Skip to content

Instantly share code, notes, and snippets.

View pagelab's full-sized avatar
🚀

Márcio Duarte pagelab

🚀
View GitHub Profile
@damiencarbery
damiencarbery / acf-flip-card.json
Last active January 6, 2020 18:11
Flip Card block with ACF Pro - Create a custom Gutenberg block for 3D hover animation - https://www.damiencarbery.com/2019/12/flip-card-block-with-acf-pro/
{
"key": "dcwd_flip_card_group",
"title": "Flip Card",
"fields": [
{
"key": "front_image",
"label": "Front image",
"name": "card_front",
"type": "image",
"return_format": "array",
@gaambo
gaambo / acf.js
Last active December 29, 2021 18:11
ACF Block with Innerblocks
import { Fragment } from "@wordpress/element";
import { InnerBlocks } from "@wordpress/editor";
/**
* Changes the edit function of an ACF-block to allow InnerBlocks
* Should be called like this on `editor.BlockEdit` hook:
* ` addFilter("editor.BlockEdit", "namespace/block", editWithInnerBlocks("acf/block-name"));`
*
* @param {string} blockName the name of the block to wrap
* @param {object} innerBlockParams params to be passed to the InnerBlocks component (like allowedChildren)
@lukecav
lukecav / functions.php
Created August 7, 2019 19:42
Add in a custom prefix and suffix to WooCommerce Order Number
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number', 1, 2);
function change_woocommerce_order_number( $order_id, $order ) {
$prefix = '#SAM-';
$suffix = '-' . date(Y);
return $prefix . $order->id . $suffix;
}
@sleepyfox
sleepyfox / 2019-07-25-users-hate-change.md
Last active September 13, 2024 08:39
'Users hate change'

'Users hate change'

This week NN Group released a video by Jakob Nielsen in which he attempts to help designers deal with the problem of customers being resistant to their new site/product redesign. The argument goes thusly:

  1. Humans naturally resist change
  2. Your change is for the better
  3. Customers should just get used to it and stop complaining

There's slightly more to it than that, he caveats his argument with requiring you to have of course followed their best practices on product design, and allows for a period of customers being able to elect to continue to use the old site, although he says this is obviously only a temporary solution as you don't want to support both.

@lukecav
lukecav / functions.php
Created June 14, 2019 18:58
Native Lazy Load to oEmbed iFrames in WordPress
function lazy_embed_oembed_html($html, $url, $attr){
$html = str_replace('<iframe ','<iframe loading="lazy" ',$html);
return $html;
}
add_filter('embed_oembed_html', 'lazy_embed_oembed_html',10, 3);
@RadGH
RadGH / acf-custom-metabox-on-options-page.php
Last active October 23, 2024 21:33
ACF: Display custom metabox on an ACF (sub-) options page
<?php
/**
* Add sub options page with a custom post id
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_sub_page(array(
'page_title' => 'CSV Sync',
'menu_title' => 'CSV Sync',
'parent_slug' => 'users.php',
@lukecav
lukecav / html
Last active September 4, 2019 13:23
Use HTML <audio> element with a WordPress site asset
<figure>
<figcaption>Caption:</figcaption>
<audio
controls
src="https://sitedomain.com/wp-content/uploads/2019/03/filename.mp3">
Your browser does not support the
<code>audio</code> element.
</audio>
</figure>
@tessak22
tessak22 / functions.php
Created March 12, 2019 12:06
Hero Gutenberg Block using Advanced Custom Fields 5.8 Pro
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block
@mindpalette
mindpalette / trim-excerpt-whitespace.php
Last active March 19, 2020 13:56
WordPress Filter - Trim Excerpt Whitespace
<?php
// trim excerpt whitespace
if ( !function_exists( 'mp_trim_excerpt_whitespace' ) ) {
function mp_trim_excerpt_whitespace( $excerpt ) {
return trim( $excerpt );
}
add_filter( 'get_the_excerpt', 'mp_trim_excerpt_whitespace', 1 );
}
@pagelab
pagelab / README.md
Created September 3, 2018 22:30 — forked from ControlledChaos/README.md
Sanitization of WordPress Customizer controls

Sanitize the WordPress Customizer

WordPress Snippets