Skip to content

Instantly share code, notes, and snippets.

View fahimxyz's full-sized avatar
🌼
I may be slow to respond.

Fahim fahimxyz

🌼
I may be slow to respond.
View GitHub Profile
@fahimxyz
fahimxyz / gutenberg.txt
Created March 8, 2021 12:25 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
Getting Started with Block Themes: Patterns
https://themeshaper.com/2021/01/11/getting-started-with-block-themes-patterns/
WordPress Blocks Backwards Compatibility
https://webdevstudios.com/2020/12/29/wordpress-blocks-backwards-compatibility/
Stylin’ WordPress Gutenberg Columns Block
https://dbushell.com/2020/11/02/wordpress-gutenberg-columns-block-css-styles/
Gutenberg Components and Invalid Hook Call Error in React
<?php
$product_content = apply_filters('the_content', get_post_field('post_content', $postID));
$product_content = preg_replace( '/et_pb_([a-z]+)_(\d+)_tb_body/', 'et_pb_df_ajax_filter_${1}_${2}_tb_body', $product_content );
$product_content = preg_replace( '/et_pb_([a-z]+)_(\d+)( |")/', 'et_pb_df_ajax_filter_${1}_${2}${3}', $product_content );
echo $product_content;
// retrieve the styles for the modules
$internal_style = ET_Builder_Element::get_style();
<?php
// Make sure you replace the following in the example:
// - META_KEY_HERE
// - LABEL_HERE
// - VISUAL_GROUP_LABEL_HERE
// Register your new Dynamic Content fields:
add_filter( 'et_builder_custom_dynamic_content_fields', function ( $custom_fields, $post_id, $raw_custom_fields ) {
$custom_fields['custom_meta_META_KEY_HERE'] = array(
'label' => esc_html( 'LABEL_HERE' ),

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.

Divi module setting fields support the use of Dynamic Content, allowing you to build dynamic modules that display information pulled from the site's database.

Enable Dynamic Content

xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew cask install iterm2
# update iterm2 settings -> colors, keep directory open new shell, keyboard shortcuts
brew install bash # latest version of bash
# set brew bash as default shell
brew install fortune
brew install cowsay
brew install git
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@fahimxyz
fahimxyz / gist:e0ff35609236fd0eb1ac6444241b898a
Created April 23, 2019 13:00 — forked from kloon/gist:4604038
WooCommerce Sale Products shortcode
<?php
add_shortcode( 'sale_products', 'sale_products' );
function sale_products( $atts ){
global $woocommerce_loop, $woocommerce;
extract( shortcode_atts( array(
'per_page' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'asc'
@fahimxyz
fahimxyz / index.php
Created April 23, 2019 12:58 — forked from ciorici/index.php
Featured Products Loop in WooCommerce 3.0
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
@fahimxyz
fahimxyz / google-reviews.php
Created April 10, 2019 02:14 — forked from iambrianreich/google-reviews.php
Use the Google Places API to render a Google My Business reviews badge on a WordPress site using shortcodes.
<?php /** @noinspection SpellCheckingInspection */
/**
* This file contains the WordPress code for rendering a Google Reviews badge.
*
* Usage:
*
* 1. Create a Google API Console account if you have not already done so.
* 2. Register for the Google Places API.
* 3. Create an API key.
* 4. Ensure that the API key can be used from wherever this script will execute