Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile

Installation

This procedure is tested on Mac OS X 10.14.0 with Xcode Developer Tools installed (xCode).

PHP 5.6, 7.0, 7.1, and 7.2 installed with Homebrew following the instructions here.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

Custom Editable Gutenberg Block

This is a basic custom editable Gutenberg block. Files explained below.

  • block.js — We register Custom Gutenberg block here.
  • editor.css _ Block CSS for the editor.
  • style.css — Block CSS for the front end.
  • index.php — Enqueue block's assets for the editor and the front end.
@moay
moay / imapsync.md
Last active June 29, 2023 05:51 — forked from dsoares/imapsync.md
Install and use imapsync in Mac OS X

Install and use imapsync in Mac OS X

brew install imapsync

Run (without ssl)

imapsync --host1 imap.from.server --user1 foo --password1 secret1 --host2 imap.dest.server --user2 bar --password2 secret2

Run (with ssl)

@squarestar
squarestar / install-wp-plugins.php
Last active December 1, 2024 00:09
Programmatically install and activate wordpress plugins
<?php
/**
* Programmatically install and activate wordpress plugins
*
* Usage:
* 1. Edit the $pluginSlugs array at the beginning of this file to include the slugs of all the
* plugins you want to install and activate
* 2. Upload this file to the wordpress root directory (the same directory that contains the
* 'wp-admin' directory).
* 3. Navigate to <your-domain-wordpress-root>/install-wp-plugins.php (If wordpress is installed
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
<?php // Do not add this line
// Reduce the primary navigation menu to two levels depth.
add_filter( 'wp_nav_menu_args', 'genesis_sample_primary_menu_args' );
function genesis_sample_primary_menu_args( $args ) {
if ( 'primary' != $args['theme_location'] ) {
return $args;
}
@the-nerdery-dot-info
the-nerdery-dot-info / programmatically_create_variable.php
Last active January 13, 2021 21:55
programmatically create woocommerce product in php
//Hi, i created a function for adding variable products based on your code. I share it here in case anyone needs it:
//The first parameter is the title of the product, $cats is the products category id which has to be an array and must be created previously, $variations is an array which contains the variations with prices, descriptions, discount, and $variations_key is the key of the parent attribute which has to be created previously on teh attributes page.
//I´m creating a ticket´s selling store and I´m using 2 globals: $logger and $vgh from my framework, please ignore them.
<?
function create_variable_woo_product($title, $cats = array(), $variations, $variations_key) {
global $wpdb, $logger, $vgh;
@davidperezgar
davidperezgar / functions.php
Created October 31, 2016 23:28 — forked from srikat/functions.php
Add Content below Title for Posts page inside div.posts-page-description in Genesis. https://sridharkatakam.com/adding-content-title-inside-div-posts-page-description-genesis/
// Bring back the missing editor for Posts page
add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
function rgc_posts_page_edit_form( $post ) {
$posts_page = get_option( 'page_for_posts' );
if ( $posts_page === $post->ID ) {
add_post_type_support( 'page', 'editor' );
}
@srikat
srikat / functions.php
Last active April 9, 2019 16:26
Add Content below Title for Posts page inside div.posts-page-description in Genesis. https://sridharkatakam.com/adding-content-title-inside-div-posts-page-description-genesis/
// Bring back the missing editor for Posts page
add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
function rgc_posts_page_edit_form( $post ) {
$posts_page = get_option( 'page_for_posts' );
if ( $posts_page === $post->ID ) {
add_post_type_support( 'page', 'editor' );
}
@davidperezgar
davidperezgar / functions.php
Created September 6, 2016 21:47
Remove a layout with the Genesis Framework.
<?php
//* Do NOT include the opening php tag
//* Remove content/sidebar layout
genesis_unregister_layout( 'content-sidebar' );
//* Remove sidebar/content layout
genesis_unregister_layout( 'sidebar-content' );
//* Remove content/sidebar/sidebar layout