Skip to content

Instantly share code, notes, and snippets.

@kolbaba
kolbaba / wp.md
Last active March 4, 2021 18:04
Wordpress General Snippets

Wordpress General Snippets

Conditionals, 
Advanced Custom Fields, 
Canonical Urls, 
Child Themes and more....

squarespace stuff

Squarespace Redirect

Simply add the snippet above into the Post-submit HTML area in the form.

<script type="text/javascript">
  // Your Squarespace form redirect URL
  var redirectURL = "http://www.google.com";
 

Terminal Snippets

# change terminal display

# PS1="%n@%m %1~ %# "
PS1="$ "

Javascript and jQuery

JS Redirect

location.href = "http://www.example.com/ThankYou.html"
# example:
if(result === "no_errors") location.href = "http://www.example.com/ThankYou.html"

Go North - Edit existing Site + Ray Notes

Clone Site & Push

Login to Gonorth Find repo at bitbucket.com

git clone repoName
git checkout -b mybranch
npm install
grunt

Terminal, Bash and ZSH Stuff

This needs to be sorted :)

# try to get hosting name
wget --save-headers superuser.com

# lookup
ping
nslookup
whois

Harden Wordpress .htaccess

Disable Directory Browsing

Options All -Indexes
(this stops directory listing for directories that have no index)
<?php
$this_term = get_queried_object();
$args = array(
    'parent' => $this_term->term_id,
    'orderby' => 'slug',
    'hide_empty' => false,
    'terms_per_page' => 2
);
$child_terms = get_terms( $this_term-&gt;taxonomy, $args );