Skip to content

Instantly share code, notes, and snippets.

View cfaria's full-sized avatar
🍊
Citius, altius, fortius... Communiter

Carlos Faria cfaria

🍊
Citius, altius, fortius... Communiter
View GitHub Profile
@izzygld
izzygld / learndash-graphql.php
Created August 17, 2020 14:34
Replace REST API with @wpgraphql with @apollographql client.
<?php
add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'sfwd-courses' === $post_type ) {
$args['show_in_graphql'] = true;
$args['graphql_single_name'] = 'course';
$args['graphql_plural_name'] = 'courses';
}
@timmyc
timmyc / woocommerce-remove-db-update-notice.php
Created April 10, 2020 21:08
Set WooCommerce DB Update Notice as Actioned
<?php
/**
* Plugin Name: Remove WooCommerce DB Notice
* Plugin URI: https://woocommerce.com
* Description: Clears out any pending WooCommerce DB Update notices
* Author: WooCommerce
* Domain Path: /languages
* Version: 0.1
*/
@alasomlira
alasomlira / index.html
Created December 10, 2019 02:11
SwiperJS & YouTube
<div class="wrap">
<div class="wrap-inner">
<div class="swiper-outter">
<div id="video-swiper" class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="video-container">
<div class="yt-player" data-id="MxBRpWcXeOA"></div>
@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)
@davewarfel
davewarfel / default-wordpress-blocks-sass.scss
Last active November 8, 2023 11:31
WordPress Blocks Styles - Cleaned Up, Commented & Sassified
/**
* WordPress Blocks
*
* Default block styling included with WordPress core.
* Provides a better starting point for WordPress theme developers,
* especially when using Sass.
*
* @link https://github.com/WordPress/WordPress/blob/master/wp-includes/css/dist/block-library/style.css
*
* Most styles from the above file are included.
@lukecav
lukecav / Commands
Last active May 19, 2024 14:55
Speed up wp db export using WP-CLI
# Export site database using wp db export
wp db export /wp-content/wordpress-dump.sql --all-tablespaces --single-transaction --quick --lock-tables=false
# Gzip compress the recent database export
gzip wordpress-dump.sql
# Export sites database using wp db export and gzip compress
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz
<?php
// Add facets
add_filter('facetwp_facets', function () {
// Video category checkboxes
$facets[] = array(
'label' => 'Video Category',
'name' => 'video_category',
'type' => 'radio',
"source" => "tax/category",
"parent_term" => "",
@djrmom
djrmom / custom-hooks.php
Created July 24, 2018 20:19
facetwp auto enable filtering button on map
<?php
/**
** enable filtering on load of map
**/
add_action( 'wp_footer', function() {
?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
var filterButton = $( ".facetwp-map-filtering" );
@mujahidi
mujahidi / wp_user_query_pagination.php
Created May 29, 2018 12:49
Pagination with WP_User_Query object
<?php
// number of users we want to show per page
$number = 10;
// to pinpoint the current pagination number
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// count the number of users that should be passed over in the pages (offset) – this will take effect at the second page onwards.
$offset = ($paged - 1) * $number;
@QWp6t
QWp6t / BedrockMultisiteValetDriver.php
Last active March 6, 2024 11:28
Fix Laravel Valet when using WordPress subdirectory multisite + Bedrock
<?php
namespace Valet\Drivers\Custom;
class BedrockMultisiteValetDriver extends \Valet\Drivers\Specific\BedrockValetDriver
{
/**
* Determine if the incoming request is for a static file.
*
* @return string|false