Skip to content

Instantly share code, notes, and snippets.

View vitaliikaplia's full-sized avatar
🇺🇦

Vitalii Kaplia vitaliikaplia

🇺🇦
View GitHub Profile
@taotiwordpress
taotiwordpress / twig-bag-of-tools.md
Last active February 18, 2025 21:47
Twig Cheatsheet #twig #timber #wordpress #cheatsheet #images #wp-query #wp_query #the_loop

Timber Bag of Tools Cheat Sheet

Useful Variables

Remember, there are 'TWIG' tools and then there are 'Timber' tools.

The second is WordPress specific.

Twig-based Variables

@jessuppi
jessuppi / gist:d6ae9421a690c79dc6bb04d0847b5997
Created August 18, 2020 19:27
WP Engine wp-config.php example
<?php
# Database Configuration
define( 'DB_NAME', 'XXX' );
define( 'DB_USER', 'XXX' );
define( 'DB_PASSWORD', 'XXX' );
define( 'DB_HOST', '127.0.0.1' );
define( 'DB_HOST_SLAVE', '127.0.0.1' );
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8_unicode_ci');
$table_prefix = 'wp_';
@treetop1500
treetop1500 / _meta.html.twig
Last active August 31, 2024 21:28
Twig template for meta tags, titles and other head element meta data.
{#
Relies mostly on a meta array containing appropriate values.
site_name is a parameter set as a Twig Global
default_share_image is a fallback parameter set as a Twig Global
#}
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="index, follow" />
<meta property="og:type" content="website" />
@chrismccoy
chrismccoy / gutenberg.txt
Last active March 13, 2025 19:11
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
How to disable and lock Gutenberg blocks
https://kinsta.com/blog/disable-gutenberg-blocks/
Convert group of file blocks to ACF block
https://bdwm.be/gutenberg-case-study-convert-group-of-file-blocks-to-acf-block/
Enabling Gutenberg-Based Custom Post Types and Taxonomies
@amboutwe
amboutwe / yoast_seo_title_change-variable.php
Last active March 25, 2025 11:02
Change existing or add custom title or meta template variables
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Change existing title or meta template variable
* Credit: Moshe Harush
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables
* Last Tested: Unknown
*/
// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {
@AprendendoLinux
AprendendoLinux / restore.sh
Last active October 30, 2020 08:37
MySQL Restore
#!/bin/bash
###################################################
## CREDENCIAIS DO MYSQL NO ARQUIVO /root/.my.cnf ##
## ##
## [mysql] ##
## user=root ##
## password='M!nh@S3nh@' ##
## host='ip-ou-dns-do-servidor' ##
## ##
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 13, 2025 08:51
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@tleish
tleish / mysql_backup.sh
Last active March 6, 2025 19:47
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
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/
@TyounanMOTI
TyounanMOTI / esed
Created February 17, 2011 17:05
'sed -e' for each file. Output result for each file.
#!/bin/bash
# esed 's/foo/bar/g' files....
script=$1
shift 1
CHANGED=1 # diff returns 1 for differences. (0 for no difference, 2 for errors.)
for file in $*
do
sed -e ${script} ${file} > ${file}~
diff ${file} ${file}~ > /dev/null