Skip to content

Instantly share code, notes, and snippets.

@Log1x
Log1x / PostSearch.php
Last active May 28, 2024 07:56
Post Search component example using Acorn v4 and Livewire 3
<?php
namespace App\Livewire;
use Livewire\Attributes\Url;
use Livewire\Component;
use WP_Query;
class PostSearch extends Component
{

This is an attempt to describe how to pass data to Gutenberg InnerBlocks when using ACF and ACF Composer. I can not share complete code examples ATM since due to reasons that I can not affect.

We will be using Gutenbergs Context. It is not 100% straight forward or easy to explain but in short, a block can provide context to its inner blocks and use context that is passed down to it.

Disclaimer: I am writing this while focusing on other things so please forgive (and tell) me if anything is unclear. It probably helps if you have some deeper understanding of how ACF and ACF Composer works.

In order to do this you need to use ACF 6 which is in alpha 2 at the time of writing this.

ACF composer needs to be updated with the changes in [this commit](https://github.com/Log1x/acf-composer/c

@Log1x
Log1x / phpmailer-smtp.php
Created March 11, 2022 16:03
Simple PHPMailer SMTP mu-plugin
<?php
use function Env\env;
/**
* Plugin Name: PHPMailer SMTP
* Plugin URI: https://roots.io/bedrock/
* Description: Simple PHPMailer SMTP configuration for Bedrock.
* Version: 1.0.0
* Author: Roots
@caco26i
caco26i / create_trellis_project.sh
Last active February 5, 2023 04:23
Create a Roots.io project working with Git Subtrees, Trellis, Bedrock, Sage
#change de URL of the repo
repo=<repo_url.git>
tools=(trellis bedrock sage) #tool from roots.io
subtrees=(trellis site site/web/app/themes/sage) #folder structure for the tools
#init repo
git init
git remote add origin ${repo}
touch .gitignore
<?php
function lv2_add_bulma_input_classes( $args, $key, $value = null ) {
// Include in functions.php
/* This is not meant to be here, but it serves as a reference
of what is possible to be changed.
$defaults = array(
'type' => 'text',
'label' => '',
@varmais
varmais / functions.php
Last active April 5, 2018 14:36
Fetch all latest Wordpress posts when using Polylang plugin
<?php
function get_default_language_posts($query)
{
if ($query->is_main_query() && is_home() && function_exists('pll_languages_list') && !is_admin()) {
$languages = pll_languages_list(array('hide_empty' => 1));
$terms = get_terms('post_translations');
$lang_default = pll_default_language();
$lang_current = pll_current_language();
$post_ids = array();
@fevangelou
fevangelou / my.cnf
Last active June 14, 2024 15:08
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );