Skip to content

Instantly share code, notes, and snippets.

@wormeyman
wormeyman / remove-excerpts-from-the-archive-pages-only.code-snippets.php
Created May 11, 2021
Generate Press remove excerpts from archive pages.
View remove-excerpts-from-the-archive-pages-only.code-snippets.php
<?php
/**
* Remove excerpts from the archive pages only
* https://generatepress.com/forums/topic/remove-excerpt-from-the-archive-pages/#post-898902
*/
add_filter('wp_trim_excerpt', 'db_excerpt_metabox_remove');
function db_excerpt_metabox_remove($excerpt)
{
@wormeyman
wormeyman / gp-remove-website-field-from-comment-form.code-snippets.json
Last active Jan 30, 2021
WordPress remove website field from comment form. Known to work with Generate Press
View gp-remove-website-field-from-comment-form.code-snippets.json
{
"generator": "Code Snippets v2.14.0",
"date_created": "2021-01-30 18:21",
"snippets": [
{
"name": "GP Remove website field from comment form",
"desc": "Remove the website field from a WordPress comment form, this is known to work well with Generate Press. There is no need for the website field anymore it is usually only used for spammy backlinks that are going to be \"no followed\" anyways.",
"tags": ["php", "WordPress", "Comments"],
"scope": "global",
"code": "add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );\nfunction tu_add_comment_url_filter() {\n add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );\n}\n\nfunction tu_disable_comment_url($fields) {\n unset($fields['url']);\n return $fields;\n}",
@wormeyman
wormeyman / brand-colors-snippet.php
Last active Dec 15, 2020
Add brand colors to the gutenberg color picker.
View brand-colors-snippet.php
<?php
function ej_add_theme_colors_to_gutenberg()
{
add_theme_support('editor-color-palette', array(
array(
'name' => esc_attr__('AWD Orange Red', 'EricJohnson'), //brand color
'slug' => 'awd-orange-red',
'color' => '#f94341',
),
array(
@wormeyman
wormeyman / ej-snaps.sh
Last active Dec 11, 2020
Snaps to install on a fresh 20.10
View ej-snaps.sh
sudo snap install chromium htop vlc signal-desktop && sudo snap install code --classic && sudo snap install powershell --classic && sudo snap install node --channel=15/stable --classic && sudo snap install vim-editor --beta && alias vim='vim-editor' && alias cd..='cd ..' && sudo apt install git --yes && git config --global user.name "Eric J"
@wormeyman
wormeyman / target_blank.php
Created Dec 3, 2020 — forked from allybee/target_blank.js
Add target="_blank" to external links with pure JavaScript. in WordPRess
View target_blank.php
add_action( 'wp_footer', function () { ?>
<script>
document.addEventListener("DOMContentLoaded", function () {
// remove subdomain of current site's url and setup regex
var internal = location.host.replace("www.", "");
internal = new RegExp(internal, "i");
var a = document.getElementsByTagName("a"); // then, grab every link on the page
for (var i = 0; i < a.length; i++) {
var href = a[i].host; // set the host of each link
@wormeyman
wormeyman / custom_css.php
Last active Sep 29, 2020
Kale custom css
View custom_css.php
<?php
$custom_css_template['colors'] = "
body{color:~color_body~}
a, a:hover, a:visited, a:active, a:focus,
.single .entry-content a,
.single .entry-content a:hover,
.single .entry-content a:visited,
.single .entry-content a:active,
.single .entry-content a:focus,
@wormeyman
wormeyman / settings.json
Created May 6, 2020
My Windows Terminal Settings
View settings.json
// This file was initially generated by Windows Terminal 0.11.1191.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@wormeyman
wormeyman / js.js
Last active Apr 10, 2020
Basic JavaScript: Chaining If Else Statements
View js.js
//https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements
function testSize(num) {
// Only change code below this line
if (num >= 20) {
return "Huge";
}
else if (num < 5) {
return "Tiny";
}
else if (num < 10) {
View staging-eatingrichly.kinsta.cloud-1550101500201.log
load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.0.3:9 JQMIGRATE: Migrate is installed, version 1.4.1
load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,wp-backbone,media-models,wp-p&load[]=lupload,wp-mediaelement,media-views&ver=5.0.3:43 Uncaught TypeError: this.activateMode is not a function
at load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,wp-backbone,media-models,wp-p&load[]=lupload,wp-mediaelement,media-views&ver=5.0.3:43
at s (blocks.build.js?ver=1550101267:1)
at Function.ss (blocks.build.js?ver=1550101267:1)
at n._createModes (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,wp-backbone,media-models,wp-p&load[]=lupload,wp-mediaelement,media-views&ver=5.0.3:43)
at n.initialize (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,he