Skip to content

Instantly share code, notes, and snippets.

@kolbaba
kolbaba / code.md
Last active September 20, 2022 13:04
Code Examples

big document of gists

lando

lando init
choose panth
choose site
// cloning db
lando start
// ignore: copy local and open web browser - don't install wp yet
{% if blog.url contains '/blogs' %}
<meta name="robots" content="noindex,follow">
{% endif %}
{% if template contains 'search' %}
<meta name="robots" content="noindex, follow">
{% endif %}
{% if handle contains 'page-handle-you-want-to-exclude' %}
<meta name="robots" content="noindex, follow">
@kolbaba
kolbaba / acf-wp.md
Last active January 11, 2023 16:10
ACF - Wordpress - Snippets

Advanced Custom Fields

PT ACF Banner Example

<!-- start .banner   -->
<?php 
	$notification_banner = null;			
	if($notification_banner = get_field('notification_banner','option')): 
        	$notification_banner = '<div class="banner"><div class="pt-banner-text">'.$notification_banner.'</div></div>';
	endif;

htaccess Snippets

## Redirect 301
Redirect 301 /oldURL /newURL

--------------------------------------------------------

## Force WWW
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
<?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 );

Harden Wordpress .htaccess

Disable Directory Browsing

Options All -Indexes
(this stops directory listing for directories that have no index)

Terminal, Bash and ZSH Stuff

This needs to be sorted :)

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

# lookup
ping
nslookup
whois