Skip to content

Instantly share code, notes, and snippets.

💻
Doing some WordPress stuff...

Allyson Souza allysonsouza

💻
Doing some WordPress stuff...
Block or report user

Report or block allysonsouza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@allysonsouza
allysonsouza / packages.config
Last active Jan 27, 2020
My Chocolatey packages.
View packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cmder" />
<package id="nodejs" />
<package id="git" />
<package id="composer" />
<package id="sourcetree" />
<package id="slack" />
<package id="gifcam" />
<package id="paint.net" />
@allysonsouza
allysonsouza / MatchAction.js
Created Oct 18, 2019
Match Moments Gutenberg Block
View MatchAction.js
import { Component } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
export default class MatchAction extends Component {
constructor() {
super( ...arguments );
}
render() {
return (
View config.cson
"*":
"atom-beautify":
executables:
phpcbf:
path: "C:\\Users\\allys\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcbf.bat"
php:
default_beautifier: "PHPCBF"
phpcbf_version: 3
standard: "WordPress-Core"
"atom-ide-ui":
@allysonsouza
allysonsouza / autoset-featured.php
Created Mar 18, 2019
Automatically sets the featured image from first <img> in post content in WordPress
View autoset-featured.php
View wp-cli-for-batch-windows.bat
## Output posts into post.txt file, only ID
wp post list --post_type=shop_order --field=ID --format=table > posts.txt
## Loop trough each post ID stored in posts.txt then run some wp-cli command, like post meta update
## Change the two %p for %%p if you want to run it in a .bat file (I run it directly on cmd)
FOR /F "tokens=1* delims=" %p IN (posts.txt) DO wp post meta update %p my_meta_key "My Value"
@allysonsouza
allysonsouza / haste-status.bat
Created Jan 29, 2019
Script to move projects from folders and search-replace WordPress databases to reflect that change
View haste-status.bat
:: Name: haste status
:: Purpose: move Haste WordPress projects from folders
:: Author: @allysonsouza
:: URL: https://github.com/allysonsouza
:: Version: 0.0.1
:: License: GPL-v2
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
@allysonsouza
allysonsouza / export.php
Created Nov 28, 2018
Export WordPress XML content acessing this file. It supports the exports of more posts than it's supported trough the panel with the same server resources.
View export.php
<?php
include 'wp-config.php';
include 'wp-admin/includes/export.php';
 
ob_start();
export_wp();
$file = ob_get_contents();
ob_end_clean();
 
@allysonsouza
allysonsouza / functions.php
Created Oct 10, 2018
Custom icon in WordPress admin menu
View functions.php
<?php
function my_custom_post_type() {
register_post_type('labs', [
'label' => 'Labs',
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="20" height="20" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="M1591 1448q56 89 21.5 152.5t-140.5 63.5h-1152q-106 0-140.5-63.5t21.5-152.5l503-793v-399h-64q-26 0-45-19t-19-45 19-45 45-19h512q26 0 45 19t19 45-19 45-45 19h-64v399zm-779-725l-272 429h712l-272-429-20-31v-436h-128v436z"/></svg>')
]);
}
add_action( 'init', 'my_custom_post_type' );
@allysonsouza
allysonsouza / .gitignore
Last active Jan 27, 2020
.gitignore template for WordPress
View .gitignore
# WORDPRESS
# Exclude WordPress core folders and root files.
wp-admin/
wp-includes/
*.php
# WP-CONTENT
# Ignore all wp-content, except for specified folders.
wp-content/*
!wp-content/haste/
@allysonsouza
allysonsouza / .deployignore
Last active Sep 11, 2019
DeployHQ - Modelo de .deployignore para WordPress
View .deployignore
## WORDPRESS CORE FOLDERS
wp-admin/**
wp-includes/**
## WORDPRESS CONTENT
wp-content/languages/**
wp-content/upgrade/**
wp-content/uploads/**
wp-content/index.php
You can’t perform that action at this time.