Skip to content

Instantly share code, notes, and snippets.

View dsawardekar's full-sized avatar

Darshan Sawardekar dsawardekar

View GitHub Profile
@TylerB24890
TylerB24890 / serialize-gutenberg.php
Last active August 12, 2019 05:36
PHP Gutenberg Serializer
<?php
/**
* Serialize Gutenberg Blocks into HTML Markup
*
* @param array $block Array of block data to be serialized
* @return string Gutenberg HTML markup of serialized block
*/
function serialize_block( $block ) {
if ( ! isset( $block['blockName'] ) ) {
return false;
@derweili
derweili / block-string-list-block.js
Created July 24, 2019 09:41
Example Gutenberg Block with array attribute
/**
* BLOCK: string-list-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
From MultiLingualPress support:
Thanks for contacting us. I'll help you to solve your problem.
First of all sorry about the api, actually we are working on them but we haven't realized the entire api interface, but things can be done with a bit of effort.
MLP use different classes that allow you to connect terms and post by passing Source/Remote site Ids and Source/Remote post/term Ids.
It is also possible to do that by making an ajax post request but the two solutions are actually slightly different.
Going to explain in deeper.
@matzeeable
matzeeable / is_rest.php
Last active October 17, 2024 13:44
Checks if the current request is a WP REST API request.
<?php
if ( !function_exists( 'is_rest' ) ) {
/**
* Checks if the current request is a WP REST API request.
*
* Case #1: After WP_REST_Request initialisation
* Case #2: Support "plain" permalink settings and check if `rest_route` starts with `/`
* Case #3: It can happen that WP_Rewrite is not yet initialized,
* so do this (wp-settings.php)
@paolocarrasco
paolocarrasco / README.md
Last active April 7, 2025 22:13
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@mintplugins
mintplugins / JSX-Gutenberg-Blocks-without-Webpack.php
Created July 29, 2018 19:18
Build JSX Gutenberg Blocks without Webpack
<?php
function my_custom_gutenberg_block_enqueue_scripts(){
// Required thing to build Gutenberg Blocks
$required_js_files = array(
'wp-blocks',
'wp-i18n',
'wp-element',
'wp-editor'
);
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active September 5, 2024 01:56
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@amboutwe
amboutwe / yoast_seo_sitemap_add_custom_type.php
Last active February 6, 2025 20:38
Filters and example code for Yoast SEO sitemaps
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Create a Yoast SEO sitemap for a custom post type
* Credit: Team Yoast
* Last Tested: Unknown
* Documentation: https://developer.yoast.com/features/xml-sitemaps/api/#add-a-custom-post-type
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* HOW TO USE
* Replace TYPE with your custom type
@afragen
afragen / Customfile.rb
Last active May 26, 2017 22:04
A Customfile for VVV to auto-create synced folders for specific VVV site and bash file to convert shared folder to symlinks.
# -*- mode: ruby -*-
# vi: set ft=ruby :
config.vm.provider :virtualbox do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
#v.memory = 2048
end
# config.vm.synced_folder "/Users/afragen/Documents/github/github-updater", "/srv/www/test3/htdocs/wp-content/plugins/github-updater", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
@elikem
elikem / AppMeasurement.js
Created December 16, 2015 17:00
AppMeasurement.js
/* Adobe Analytics
Marketing Reports & Analytics
Copyright 1996-2013 Adobe, Inc. All Rights Reserved */
s = new AppMeasurement();
s.account="outrainjjscit13site05,outrainjjscit13global"
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */
s.charSet="UTF-8"