Skip to content

Instantly share code, notes, and snippets.

View leroyrosales's full-sized avatar
:octocat:

Leroy Rosales leroyrosales

:octocat:
View GitHub Profile
@f3bruary
f3bruary / create-block.js
Last active July 7, 2022 21:08
NPM script to create ACF layout directory
#!/usr/bin/env node
/*
* Create ACF Flexible Layouts
*/
// Require modules.
const fs = require( 'fs' );
const args = process.argv.slice( 2 );
@taotiwordpress
taotiwordpress / debugging-cheatsheet.md
Created March 4, 2022 23:30
Debugging Cheatsheet #cheatsheet #debugging

Debugging

Options to Enable Debugging

These changes need to be made in your active wp-config.php file in order to be used (or dumped in a wp-config-local.php file).

<?php

/* PHP errors, notices and warnings will be displayed */
@ivo-ivanov
ivo-ivanov / optimize-wp.php
Last active April 1, 2024 11:23
Optimize WordPress. Remove unnecessary code from wp_head. Disable trackbacks and pings. Disable and remove comments on front-end and back-end. Remove oEmbed functionality. Disable emojis on front-end and remove the tinymce emoji plugin. Remove link tags in header. Remove jQuery Migrate #wordpress
<?php
// Remove Unnecessary Code from wp_head
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action( 'wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link');
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 10, 2024 09:38
Online Resources For Web Developers (No Downloading)
@bradtraversy
bradtraversy / ssh.md
Last active May 8, 2024 23:05
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@davepullig
davepullig / gist:efddb9a894e0c4a824b4b61183cfb01c
Last active April 24, 2023 06:26
WP CLI search and replace URLs for WordPress multisite
wp search-replace --network --url=website.dev website.dev website.tld --precise --all-tables
@jssuttles
jssuttles / csv-to-json.js
Last active April 30, 2021 11:54 — forked from iwek/csv-to-json.js
CSV to JSON Conversion in JavaScript
//var csv is the CSV contents with headers
function csvJSON(csv){
var lines=csv.split('\n');
var result = [];
var headers=lines[0].split(',');
lines.splice(0, 1);
lines.forEach(function(line) {
var cornify_count = 0;
var cornify_add = function() {
cornify_count += 1;
var cornify_url = 'http://www.cornify.com/';
var div = document.createElement('div');
div.style.position = 'fixed';
var numType = 'px';
var heightRandom = Math.random()*.75;
var windowHeight = 768;
@gbyat
gbyat / latest-and-first.php
Last active March 24, 2024 17:41
get latest and first post in WordPress
/******************************************
* get latest post
* use in loop if ( is_latest() ) { stuff; }
******************************************/
function is_latest() {
global $post;
$loop = get_posts( 'numberposts=1' );
$latest = $loop[0]->ID;
return ( $post->ID == $latest ) ? true : false;
}
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );