Skip to content

Instantly share code, notes, and snippets.

View iamjoshellis's full-sized avatar
🏝️

Josh Ellis iamjoshellis

🏝️
View GitHub Profile
@wesbos
wesbos / is_blog.php
Created September 2, 2011 19:32
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@csknk
csknk / header.php
Last active February 23, 2016 13:27
Dropdown BS Nav
<?php require_once(get_template_directory() . '/lib/nav.php'); ?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@janwillemtulp
janwillemtulp / simple-password-protection.svelte
Created May 20, 2020 12:45
Svelte simple static page password protection
<script>
let password = ''
const hash = s =>
s.split('').reduce((a, b) => {
a = (a << 5) - a + b.charCodeAt(0)
return a & a
}, 0)
$: console.log(password, hash(password))