Skip to content

Instantly share code, notes, and snippets.

@jomurgel
jomurgel / highlight-search.php
Created November 5, 2017 04:32
Highlight searched term in content
<?php
function get_highlighted_content( $args = array() ) {
// Setup defaults.
$defaults = array(
'content' => get_the_title(),
);
// Parse args.
@jomurgel
jomurgel / ftp-fix.md
Last active January 7, 2021 18:17
Fix FTP issue for WordPress on DigitalOcean

1. Web Server Ownership

#The first level is actually to make sure that your web server has ownership over the directories: chown -R www-data:www-data your-wordpress-directory

2. Directory Permissions

The second level is also required – you must make sure that the directory permissions are properly set:

sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \; sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

@jomurgel
jomurgel / download.clt
Created November 6, 2017 18:12
Download file from server
scp -r user@host:/path/to/folder/ local-copy-of-folder
@jomurgel
jomurgel / command.bash
Last active December 5, 2018 17:58
Production images on local Valet
$ sudo nginx -s reload
@jomurgel
jomurgel / arrayCheck.js
Created March 25, 2018 18:24
Remove Differences from 2 Arrays
// Remove all but similariy.
array1.filter( item => array2.every( item2 => item2.id !== item.id ) );
// REmove similarity.
array1.filter( item => array2.every( item2 => item2.id === item.id ) );
@jomurgel
jomurgel / arrayCheck.js
Last active July 8, 2018 21:34
Remove Differences from 2 Arrays
const array1 = [1, 2, 3, 4, 5];
const array2 = [1];
// Return all but similariy.
array1.filter( item => array2.every( item2 => item2.id !== item.id ) ); // Returns [2, 3, 4, 5]
// Return similarity.
array1.filter( item => array2.every( item2 => item2.id === item.id ) ); // Returns [1]
@jomurgel
jomurgel / .htaccess
Last active May 14, 2018 01:09
Installing Let's Encrypt with Cerbot on DigitalOcean & ServerPilot
## Redirect all HTTP and www to HTTPS
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
@jomurgel
jomurgel / mediaquery.scss
Last active December 12, 2018 18:11
SCSS Breakpoint Mixin
//-----------------------------------------
// Breakpoints
//-----------------------------------------
$desktop: 1440px;
$tablet: 960px;
$mobile: 600px;
//-----------------------------------------
// Media Query Mixin
//-----------------------------------------
@jomurgel
jomurgel / cpt.php
Last active September 9, 2018 06:10
Register multiple CPTs or Taxonomies in WordPress
<?php
/**
* Custom post types and/or taxonomies.
*
* @package Acorn Theme
*/
/**
* Register Custom Post Types
*/