Skip to content

Instantly share code, notes, and snippets.

Doing some WordPress stuff...

Allyson Souza allysonsouza

Doing some WordPress stuff...
View GitHub Profile
allysonsouza / launch.json
Created Sep 24, 2021
[VS Code XDebug launch.json] VS Code XDebug launch.json config #vscode #xdebug
View launch.json
"version": "0.2.0",
"configurations": [
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
allysonsouza /
Last active Sep 24, 2021
[PHP CLI Commands] #php

PHP CLI Commands

Display instaled modules

php -m -c

allysonsouza / wp-remove-dashboard-widgets.php
Created Aug 28, 2021
Remove WordPress dashboard widgets
View wp-remove-dashboard-widgets.php
* Remove dashboard widgets.
function remove_dashboard_widgets() {
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
allysonsouza / wordpress-create-media-from-filepath.php
Last active May 16, 2021
Create a WordPress media from file path and attach it to a post.
View wordpress-create-media-from-filepath.php
* Create media from path.
* @param string $file_path
function create_media_from_path( $file_path, $post_id = 0 ) {
// Requires
require_once( ABSPATH . 'wp-admin/includes/admin.php' );
require_once( ABSPATH . 'wp-admin/includes/image.php' );
allysonsouza / fetch_plugin.js
Created May 14, 2021 — forked from cwhittl/fetch_plugin.js
Using Fetch with Wordpress Plugins Ajax
View fetch_plugin.js
fetch(ajax_url, {
method: 'POST',
credentials: 'same-origin',
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
body: 'action=zget_profile_user'
.then((resp) => resp.json())
.then(function(data) {
if(data.status == "success"){
allysonsouza / install-commands.php
Last active Jul 21, 2021
WP Install Command - Copy command to install plugins trough WP-CLI or Composer easily.
View install-commands.php
Plugin Name: Install Commands
Plugin URI:
Description: Copy command to install plugins trough WP-CLI or Composer.
Author: Allyson Souza
Version: 1.0
Author URI:
Text Domain: install-commands
Domain Path: /languages
allysonsouza / about.js
Last active Sep 11, 2020
Question: Using inline images in Gatsby markdown
View about.js
import React from "react";
import "./_about.scss";
import { FormattedMessage, useIntl } from "gatsby-plugin-intl"
import AboutEN from "./about.en.mdx"
import AboutPT from "./"
import AboutES from "./"
export default function Header() {
const intl = useIntl()
allysonsouza / packages.config
Last active Aug 16, 2020
My Chocolatey packages.
View packages.config
<?xml version="1.0" encoding="utf-8"?>
<package id="cmder" />
<package id="nodejs" />
<package id="git" />
<package id="composer" />
<package id="sourcetree" />
<package id="slack" />
<package id="gifcam" />
<package id="" />
View config.cson
path: "C:\\Users\\allys\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcbf.bat"
default_beautifier: "PHPCBF"
phpcbf_version: 3
standard: "WordPress-Core"
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