Skip to content

Instantly share code, notes, and snippets.

View zzap's full-sized avatar

Milana Cap zzap

View GitHub Profile
<?php
/**
* Get all users with `wpcli.loc` in their email address
* and export them to `users.csv` file.
*
* Execute this script with:
* wp eval-file get-users.php
*/
$fields = [
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@zzap
zzap / currency_symbols.php
Created August 22, 2019 10:15 — forked from gibbs/currency_symbols.php
An array of currency symbols as HTML entities
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
import gql from 'graphql-tag'
import { client } from '../utils/apollo-client'
const { parse } = wp.blocks;
const { select, subscribe, dispatch } = wp.data;
const GET_PAGE_BLOCK_TEMPLATE = gql`
query GET_PAGE_BLOCK_TEMPLATE($id: ID!, $template: String) {
page( id: $id ) {
blockTemplate( pageTemplate: $template )
}
}
@zzap
zzap / .htaccess
Created May 31, 2018 21:08 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@zzap
zzap / drupal-views-share-global-text-field
Created June 9, 2017 13:58 — forked from chrisl8888/drupal-views-share-global-text-field
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>
@zzap
zzap / jquery-boilerplate.js
Created October 5, 2016 06:49 — forked from tommcfarlin/jquery-boilerplate.js
[WordPress] Properly loading jQuery within WordPress without having to use the `noConflict` method, or creating your own reference such as `$wp = jQuery`.
/**
* This gist demonstrates how to properly load jQuery within the context of WordPress-targeted JavaScript so that you don't
* have to worry about using things such as `noConflict` or creating your own reference to the jQuery function.
*
* @version 1.0
*/
(function( $ ) {
"use strict";
$(function() {
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@zzap
zzap / wp-numbered-pagination.php
Last active September 30, 2016 20:06
Numbered pagination, full and simple, for default and custom archives/queries.
<?php
/**
* Numbered pagination
*
* Rendering full pagination on archive pages in numbered form.
* Also, add 'first' and 'last' links because 'prev' and 'next'
* are just not enough sometimes.
*
* @link http://codex.wordpress.org/Function_Reference/paginate_links
*
@zzap
zzap / wp-trim-post-content.php
Created September 30, 2016 19:15
Trim post content down to exact number of words or characters.
<?php
/**
* Content trim characters
*
* Trim post content down to exact number of characters.
*
* @uses string_trim_characters()
*
* @param int $length Number of characters
* @param string $after Append to content